Slashdot Mirror


Build a Database Driven Site -- Quick

norburym (Mary Norbury-Glaser) writes "The third edition of Build Your Own Database Driven Website Using PHP & MySQL is written by Kevin Yank, Technical Business Director for sitepoint.com, a popular online resource for Web development. Updated for PHP 5 and MySQL 4 in this edition, Yank has put together an easy-to-follow, hands-on tutorial using the tools and techniques necessary to build a functional database-driven Web site. Many Web designers don't have deep knowledge and experience in data coding but want to get started serving up dynamic Web pages. This book gives designers and beginning coders a concise introduction to PHP and MySQL and quickly brings the reader to the page-creation stage." Read on for the rest of Norbury-Glaser's review. Build Your Own Database Driven Website Using PHP & MySQL author Kevin Yank pages 359 publisher Sitepoint rating 8 reviewer Mary Norbury-Glaser ISBN 0975240218 summary Using PHP and MySQL to Build Your First Data Driven Website

Yank starts with the basics of MySQL and PHP installation on Windows, Linux and Mac OS X systems (he notes PHP 4.3 differences as well), and walks the reader through his first PHP script (no, not "Hello World!"). This first chapter is well written, with step-by-step instructions and shell script examples. It will help even a newbie feel comfortable with the process, and encourage him or her to move on to the rest of the book.

Chapter 2 focuses on relational databases and SQL queries. This chapter is not an in-depth study of RDBMs, but rather an extremely brief overview of the concepts involved in order to introduce the reader to command line interaction with MySQL. A simple database is begun that will be used in later chapters.

Basic syntax and commands of PHP are covered in Chapter 3 (statements, variables, operators). There are a lot of simple examples here that clearly demonstrate the elemental concepts of PHP. Yank uses forms, user interaction and control structures (if-else, while loop, for loop) to illustrate some easy methods of data access and user interaction with PHP.

Chapter 4 combines the two previous chapters' concepts into the beginnings of a working data-driven Web site. Yank shows the reader how to use PHP to connect to a sample MySQL joke database ("A man walks into a bar....Ouch."). He introduces sending SQL queries with PHP (mysql_query, delete, insert, update), handling SELECT result sets and inserting data into the sample ijdb (Internet Joke) database.

Chapter 5 is devoted to relational database design, and expands the one-to-one relationship to many-to-one, one-to-many and many-to-many relationships, this chapter teaches the reader how to join data spread between tables into one resultant set. This chapter is not meant to deal comprehensively with the complexities of relational database design. Indeed, the author gives an extremely brief nod to the inherent informality of his approach and references other resources for deeper study. Yank's intention here, as with the entire book, is to use relevant real-world examples to illustrate the simpler types of relationships a beginner will experiment with and how to deal with complex data and table issues with good design practice.

The next chapter presents content management and restricted-access database administration without relying on the command line (a few hints on protecting pages with appropriate access restrictions are in the introduction to this chapter but aren't dealt with in any depth until Chapter 12). Chapter 4's mention of forms is revisited here, and forms are used to manage, add, search for, edit and delete data.

At this point, the reader will have designed a database, organized the data into categories, created Web pages to display the data to site visitors, and prepared pages for administration of the data. The HTML is separate from the data, thereby relieving the Webmaster from the onerous and constant task of having to refresh pages with content. Here, in Chapter 7, the reader learns to format and submit content without resorting to hand-written HTML by using PHP functions (Yank covers the more standardized POSIX regular expressions, not PCRE). Code examples for string replacement, boldface and italic text, paragraphs, hyperlinks and splitting text into pages are included. The last bit of this chapter is dedicated to automatic content submission and has a nice design note about creating a visible column to the joke table where newly submitted jokes are handled as a No value, which allows review by a content manager before being posted.

This leads well into Chapter 8, "MySQL Administration (backing up, access control, checking and repairing data files)." Yank explains mysqldump and the use of update logs to create a practical backup-management scheme. He also covers using the myisamchk utility to check and repair MySQL data files. Basic MySQL access control using GRANT (creates new users, assigns passwords and adds user privileges) and REVOKE (the reverse of those functions) is included in this chapter as well, along with some tips and tricks to prevent access control problems.

Chapter 9 "gets back to the fun stuff" with Advanced SQL Queries (sorting and GROUPing SELECT results, setting LIMITs, LOCKing TABLES, aliases, LEFT JOINs and Limiting results with HAVING) giving the reader a well rounded sense of the versatility and scope of SQL in general and the SELECT command in particular.

Yank veers from textual data in Chapter 10, "Binary Data" (image files, encryption keys, programs for download) and shows the reader how to deal with working with files in PHP, handling uploaded files in PHP, storing and retrieving binary data in MySQL and learning when to use semi-dynamic pages to lighten the load on server performance in the process.

Chapter 11 deals with creating persistent variables, and offers an excellent description of cookies and sessions in PHP. I like Yank's figure "the life cycle of a cookie," which shows a graphical representation of a PHP-generated cookie. Yank rounds out the chapter with a simple shopping-cart example that consists of PHP scripts handling a product catalog and a checkout page (very real world).

The final chapter of the book is titled "Structured PHP Programming," and focuses on techniques for organizing code in order to simplify management (using include files, writing your own functions and streamlining code within Web pages). Yank gives a lot of sensible advice here, and his approach is not preachy. He brings up many important pitfalls that developers fall into: too much code, difficulty of finding what you need, understanding how it works. As this is a beginner's book, I would say that good design, good technique and good sense go a long way and should be stressed at the start of anyone's career in coding.

Build Your Own Database Driven Website Using PHP & MySQL, 3rd Edition runs only about 350 pages with a clean, easy-to-read page design, comfortable typography, lots of script boxes and screen shots. The appendices cover MySQL syntax, functions and column types and PHP functions for working with MySQL. Errata can be found at sitepoint's Web site, and I can't stress enough the value of checking these out before delving into any technical or instructional book: the frustration level goes way down if you know in advance that there's a typo, or a step missing!

This is a beginner's book with the essential tools and techniques that will get anyone started with serving up their first dynamic Web site. The tutorial approach of this book makes it easy for any reader to follow the step by step instructions. Yank manages to cover pretty much every topic necessary to provide the reader with a clean overview of the topic. It's a quick read and gives the reader encouragement and enough knowledge to move on to more complex volumes on the subject. This book provides a great first step for the beginner."

You can purchase Build Your Own Database Driven Website Using PHP & MySQL from bn.com. Slashdot welcomes readers' book reviews -- to see your own review here, read the book review guidelines, then visit the submission page.

251 comments

  1. Do you really need a book for this? by Anonymous Coward · · Score: 2, Funny

    It's like boiling water these days.

    1. Re:Do you really need a book for this? by ArsenneLupin · · Score: 4, Funny
      It's like boiling water these days.

      And using ASP/MsSqlServer is like pouring it down your crotch. And contrarily to popular opinion, Microsoft is not McDonalds ;-)

    2. Re:Do you really need a book for this? by Saeed+al-Sahaf · · Score: 1

      Building anything with .asp is like pouring boiling water down your crotch.

      --
      "Who are in control, they are not in control of anything - they don't even control themselves!" - Glen Beck
    3. Re:Do you really need a book for this? by Anonymous Coward · · Score: 5, Funny

      > Microsoft is not McDonalds

      But they're both run by scary-looking clowns.

    4. Re:Do you really need a book for this? by arkanes · · Score: 1

      Yes, but using PHP and MySQL is like pouring non-boiling, but germ infested sewer water down your crotch. You're almost certain to catch something.

    5. Re:Do you really need a book for this? by Bake · · Score: 1

      No, one is a scary looking clown, the other is a scary looking bald gorilla.

  2. s? by Anonymous Coward · · Score: 0

    Database driven S?

  3. Using PHP & MySQL to Build a Database Driven S by rackhamh · · Score: 2, Funny

    Apparently a much needed book!

  4. ROR! by Ramses0 · · Score: 1, Informative

    ROR! -- "Using PHP & MySQL to Build a Database Driven S"

    quickly changed to: "Build a Database Driven Site -- Quick"

    MMmmmmmh @ Perl + Mysql. ;^)

    --Robert

    1. Re:ROR! by Anonymous Coward · · Score: 0

      With all the editing the admins do to their own posts, you'd think they'd get around to letting us edit ours.

  5. For the last time! by Anonymous Coward · · Score: 2, Insightful

    A summary is NOT a review.

    1. Re:For the last time! by ahdeoz · · Score: 1

      A review is not a commentary or opinion.

  6. Using PHP & MySQL to Build a Database Driven S by Digital+Pizza · · Score: 0, Redundant

    Slashdot meets Sesame Street?

    --
    We apologize for the inconvenience.
  7. Re:Using PHP & MySQL to Build a Database Drive by carpe_noctem · · Score: 1

    I was just using flat files for my S, and it was no good! Thanks to this book, my S is now running 150% faster and I can now start working on T-Z!

    --
    "Quoting famous computer scientists out of context is the root of all evil (or at least most of it) in programming." - K
  8. Considering most of the sites I have seen by Anonymous Coward · · Score: 1, Funny

    They were built extremely quickly. If they weren't built quickly, I can only surmise that these sites were all a product of those who ride the short bus.

    1. Re:Considering most of the sites I have seen by contagious_d · · Score: 1

      I ride the short bus, asshole.

      --
      - /home is where the food is.
  9. SQLlite by Philmeeh · · Score: 4, Informative

    If you really want to set up a quick database site then you may as well use SQLlite that comes bundled in PHP5. No need to worry about connecting to a separate mySQL server with all those niggling connections

    1. Re:SQLlite by odyrithm · · Score: 2, Insightful

      SQLite needs to connect to a db in the fs anyway, in much the same way as mysql, pgsql, mssql etc etc client needs a socket connection. Don't get me wrong SQLite owns your socks, but it's no easier to use than *the real* dbms's.

      --
      moo
    2. Re:SQLlite by XorNand · · Score: 3, Informative

      I tend to think along the same lines. Maybe I'm a bit of an elitist, or it's the fact that I despise contending with so many horrid DBs thrown together by people who had no clue what they were doing. I'm sorry, but these "implement technology x in minutes" books really rub me the wrong way. Why don't people take the time to learn how to properly use their choosen tools? I wouldn't expect to be able pick up a wrench today and then begin building an engine tomorrow. Designing a good relational database requires some know-how. If you want to do something fast, use a simple flat file.

      --
      Entrepreneur : (noun), French for "unemployed"
    3. Re:SQLlite by arkanes · · Score: 2, Insightful

      Eh? No. "connecting" in SQLite is managed by passing it a filename. It's orders of magnitudes simpler than installing, configuring, and connecting to a client/server RDBMs.

    4. Re:SQLlite by odyrithm · · Score: 1

      Eh? No. "connecting" in SQLite is managed by passing it a filename. It's orders of magnitudes simpler than installing, configuring, and connecting to a client/server RDBMs.

      Maybe I've grown resilient to the ease of my own intellect in my young age.

      Seriously though..

      $ pacman -S mysql
      $ /etc/rc.d/mysql start
      $ mysqladmin -u root password 'newpassword'
      $ mysql -u root -p
      >create database somedb;
      >grant all privileges on somedb to somedewd@somehost identified by 'somepassword';
      >flush privileges;
      >ctrl+d

      really, common take the initiative, it will not bite!

      --
      moo
    5. Re:SQLlite by odyrithm · · Score: 1

      It's orders of magnitudes...

      Oh I really am sorry but that makes me laugh, hardy heartly, you know how to make a fellow geek laugh I give you that.

      --
      moo
    6. Re:SQLlite by 0x000000 · · Score: 1

      Found a flaw:

      cryptic# pacman
      pacman: Command not found.

      Mabey it is YOU that needs to read a book on how to set up MySQL not using unconventional only certain distrobution packaging tools.

      --
      cat /dev/null > .signature
    7. Re:SQLlite by arkanes · · Score: 1

      What, you didn't know there was more than one kind of magnitude? ;)

    8. Re:SQLlite by arkanes · · Score: 1

      First off, thats 8 more things than you need to do to set up SQLite. Secondly, all of them are fairly complicated if you don't already know exactly what you want to do (even more so if you don't have a pre-packaged installer, but I'll grant that). Lastly, and most importantly, it's *wrong*, which is one reason why using SQLite in this instance is better. No configuration of your firewall? No port configuration? Granting *all* privledges to the web user?!

    9. Re:SQLlite by odyrithm · · Score: 1

      pacman just happens to be the package manager I use under linux numbnuts.

      Really why do we have to spell out things for people like you.

      --
      moo
    10. Re:SQLlite by odyrithm · · Score: 1

      Oh offcourse, I just need more beer to reach those levels :P

      --
      moo
    11. Re:SQLlite by odyrithm · · Score: 1

      No configuration of your firewall? No port configuration? Granting *all* privledges to the web user?!

      Well no, localhost mysql has nothing more than the loopback to contend with, and if you stick chains on that then your just nuts, really though that would BE funny.

      All pivileges was just a fricking example.

      --
      moo
    12. Re:SQLlite by arkanes · · Score: 1
      Well no, localhost mysql has nothing more than the loopback to contend with, and if you stick chains on that then your just nuts, really though that would BE funny.

      Maybe in your particular distros packaging of it. On Windows, MySQL out of the box binds to all addresses, including external ones. I believe this is also the case with the stock RPMs on Redhat. Regardless, now it's getting a little more complicated because you need to know about these sort of issues and what the defaults for your environment are, right?

      All pivileges was just a fricking example.

      Exactly my point.

    13. Re:SQLlite by VGPowerlord · · Score: 1

      For some reason, we can't get PHP's developers to bundle MySQL or PostgreSQL with PHP. For any other programming language, you still need to configure and install SQLite and install a module for SQLite. ...or use your OS's handy ports system to install it. MySQL also has a nice perl interface to set permissions, aptly named mysql_setpermission.

      --
      GLaDOS for President 2016! "Well here we are again. It's always such a pleasure." -- GLaDOS, 2011
    14. Re:SQLlite by VGPowerlord · · Score: 1
      For some reason, we can't get PHP's developers to bundle MySQL or PostgreSQL with PHP.

      For any other programming language, you still need to configure and install SQLite and install a module for SQLite.

      ...or use your OS's handy ports/package system to install it. That IS what it's there for, after all.

      MySQL also has a nice perl interface to set permissions, aptly named mysql_setpermission.

      Note: Ignore my previous comment. I accidently clicked submit instead of preview. All in favor of making a post required to be previewed once before Submitting, raise your mouse!

      --
      GLaDOS for President 2016! "Well here we are again. It's always such a pleasure." -- GLaDOS, 2011
    15. Re:SQLlite by odyrithm · · Score: 1

      Maybe in your particular distros packaging of it.

      I really do NOT want to get into an argument with you, but seriously read up on what a loopback is, it applies to OS's across the board that "network". It's a standard, no shit.

      more complicated because you need to know about these sort of issues

      I've always believed in learning.. nuff said.

      --
      moo
    16. Re:SQLlite by nofx_3 · · Score: 2, Informative

      IIRC pacman is the packages manager for Archlinux, it uses a tar.gz package much like slackware. It's quite good although I still prefer debian just for the sheer number of packages in its repository. Even compiling php and mysql from source shouldn't be too difficult for any competent linux user.

      -kaplanfx

      --
      Visualize Whirled Peas
    17. Re:SQLlite by arkanes · · Score: 1
      I know what a loopback address is. I also know that, by default, on Windows, MySQL listens to *all* addresses, not just the loopback. Which means there's an additional step involved in locking down MySQL either via configuration or a firewall.

      The argument was not that "learning is bad". It was "SQLite is much simpler and faster to [correctly] install and configure than MySQL, or any other client/server database for that matter". And it is.

    18. Re:SQLlite by ahdeoz · · Score: 1

      An "Order of magnitude" means "times ten." That's all really. "Orders of magnitude" would mean more than one order, so I guess it means "times 100." "Orders of magnitudes" would mean more than one magnitude, so it would be: 2x*(10+y), y>=10, y%10 =0 Or in other words "at least times 400." So why not just say so. Sheesh.

  10. DAre I say - a waist of money! by MBraynard · · Score: 4, Insightful
    BAsed on this summary/review, this sounds like a re-write of the already free help files for PHP and MySQL. Truth is, you probably don't even need the MySQL help file as the PHP documentation covers interaction with the database pretty well and pretty much every webhost out there is running phpMyAdmin for the database management.

    And really, if you don't already have an understanding of basic DB design (tables, fields, records, data types, etc.) are you really going to be designing such a site? If you didn't, there are plenty of free resources on the web to help you do that.

    Programming is primarily a self-starter job. You learn by doing, and by using free resources out there on the web. Why pay money for a book that regurgitates already free information for two pieces of free software.

    1. Re:DAre I say - a waist of money! by anamin · · Score: 5, Insightful

      Because it's nice to have all of that information put into a single reference. When I need to look up something at a later date I'd much prefer having a book that I can quickly find the info I need, rather than digging through google, or finding out the site I book marked is no longer in existance.

    2. Re:DAre I say - a waist of money! by Anonymous Coward · · Score: 0

      DAre I say - a waist of money!

      A bit greedy, aren't you? I'd settle for just a pocket full.

    3. Re:DAre I say - a waist of money! by winkydink · · Score: 4, Insightful
      Programming is primarily a self-starter job. You learn by doing, and by using free resources out there on the web. Why pay money for a book that regurgitates already free information for two pieces of free software.

      Programming well, on the other hand....

      --

      "I'd rather be a lightning rod than a seismometer." -Ken Kesey

    4. Re:DAre I say - a waist of money! by StandardsSchmandards · · Score: 5, Funny

      Dare I say - a waist of money!

      My waist is mostly made up of fat. I would be happy if it was made of money. I could have used the money to buy a good PHP book.

    5. Re:DAre I say - a waist of money! by Anonymous Coward · · Score: 0

      Maybe the poster is referring to one of those funky money belts?

    6. Re:DAre I say - a waist of money! by Anonymous Coward · · Score: 0


      If you're looking something up at a later date, then what you're looking up has probably changed since the book was printed.

    7. Re:DAre I say - a waist of money! by Frymaster · · Score: 1
      When I need to look up something at a later date I'd much prefer having a book

      really? i'd way rather have an electronic reference. witness:

      • i can't to a regex search on a book
      • my mozilla bookmarks never fall out of my browser when i shake it
      • i can copy the electronic version limitless without killing trees
      • the website gets updated everytime there's a change. the book gets update once every year or two and costs another $50

      i could go on and on and on. but you'd probably want to punch me if i did...

    8. Re:DAre I say - a waist of money! by Tablizer · · Score: 1

      BAsed on this summary/review, this sounds like a re-write of the already free help files for PHP and MySQL.

      People, please stop saying this. Altough the web makes a great reference, for learning new stuff I find books can be nicer for the following reasons:

      1. They are easier on the eyes. At least for me, paper is just clearer and less tiring over the long-haul. Screens still have catching-up to do in this deparment.

      2. Easy to grab a pencil and mark the damned thing up, drawing lines, arrows, circling stuff, etc. The computer techology to do something similar is not up to snuff yet.

      3. Real estate. One can have the book open and their work on the screen at the same time. If you use your screen for both the training material and your work, then you have to keep swapping back and forth. A book is like a second monitor.

      4. No plug. Books are portable and work well in direct sunlight. I can take one outside to peruse while keeping an eye (or ear) on the kids.

    9. Re:DAre I say - a waist of money! by Tablizer · · Score: 1

      And really, if you don't already have an understanding of basic DB design (tables, fields, records, data types, etc.) are you really going to be designing such a site?

      Perhaps some companies run out of graphics work and so wish to move a web designer into programming rather than fire them. It happens.

    10. Re:DAre I say - a waist of money! by LurkerXXX · · Score: 1

      5. Your time is worth something. Yes, you can find all sorts of useful tips and manuals for everything online. But it can take time to track down the good sources. Haveing someone else already do that and index and collate it for you is very handy.

    11. Re:DAre I say - a waist of money! by DrEldarion · · Score: 4, Insightful

      How many people who will be buying this book know how to do regex searches?

    12. Re:DAre I say - a waist of money! by grazzy · · Score: 1

      Everything, and I mean everything, is on php.net and mysql.com/doc.

      If you're on a dialup I could see how a book could be resonable. Otherwise - take a database-course/class (cause theres no way you'll learn it the proper way without it anyway) and start hacking.

    13. Re:DAre I say - a waist of money! by yotto · · Score: 1

      How many people who will be buying this book know how to do regex searches?

      I don't think I'll buy the book, but It intrigued me. I've just started getting php/mysql/apache running on a linux box so it's all quite new to me.

      I've been doing regex searches for quite some time now. Perhaps a decade.

    14. Re:DAre I say - a waist of money! by MBraynard · · Score: 1
      Yeah - and you can print this stuff out too if you really wanta book.

      I am building such a site right now and I am a total hacker. We don' need no stinkin' BOOKS.

    15. Re:DAre I say - a waist of money! by grazzy · · Score: 1

      I'd rather spend my money on a book which i might actually learn something from. I dont know about you. But if you so desperatly wanna dump your money, why not donate it to the phpfolks...

    16. Re:DAre I say - a waist of money! by Anonymous Coward · · Score: 0

      DAre I say - a waist of money!

      BAsed on this summary/review...

      You need to learn to sync your left and right hand better...let go of the shift key a split-second sooner.

    17. Re:DAre I say - a waist of money! by Steve+Cowan · · Score: 1

      The problem is that you can't read an "electronic reference" on the toilet - a sacred place where I have learned about 80% of everything I know that's technical.

    18. Re:DAre I say - a waist of money! by Anonymous Coward · · Score: 0


      THAnks, I'L HAVe TO TRY THAt.

    19. Re:DAre I say - a waist of money! by Q2Serpent · · Score: 1

      Why not?

      Wireless works wonders. Watch for leg burns though.

    20. Re:DAre I say - a waist of money! by MBraynard · · Score: 1

      Sorry. For some reason my keyboard is all sticky and that happens from time to time. Thanks for the analysis.

    21. Re:DAre I say - a waist of money! by Anonymous Coward · · Score: 0

      Only if you aren't already on the internet. Before anyone starts saying "but what is the use if you are building a web site..." well it could be a local intranet site (company specific without the desire for web traffic and on a 192.168 address). As others have stated, getting the current info off the net is best, unless you are on a private site with no internet access (just local network access).

    22. Re:DAre I say - a waist of money! by Anonymous Coward · · Score: 0

      Sticky keyboard?

      Lay off the porn or at least aim in a different direction.

  11. Leans more toward the DB side by bbzzdd · · Score: 4, Informative

    As the title suggests. Nothing about PHP templating technology (like Smarty) which can lead to some pretty gnarly PHP code. I'd recommend following this book up with Advanced PHP Programming by George Schlossnagle as it focuses more on PHP.

  12. Build a Database Driven Site -- Quick by Anonymous Coward · · Score: 3, Funny

    Shouldn't that be "Quickly", or are we allowed to modify verbs with adjectives on Slashdot?

    1. Re:Build a Database Driven Site -- Quick by Anonymous Coward · · Score: 0

      I would presume that the "Quick" was used as an interjection following an imperative rather than as an adverb.

      The ! exclamation mark that should have followed was probably missed due to following the imperative too quickly...

    2. Re:Build a Database Driven Site -- Quick by anagama · · Score: 1

      • Shouldn't that be "Quickly", or are we allowed to modify verbs with adjectives on Slashdot?

      No. It is "quick". Remember all the apple stories recently? Slashdot has learrned to "think different".
      --
      What changed under Obama? Nothing Good
    3. Re:Build a Database Driven Site -- Quick by Anonymous Coward · · Score: 0

      You be lucky find grammer and speling that is readable also it not details that matter just contentss

    4. Re:Build a Database Driven Site -- Quick by arkanes · · Score: 1

      Notice the emdash. As punctuation, and in this case, it's used to conjoin 2 seperate statements, much like a colon or semi-colon -- allowing the author to combine two seperate but related thoughts into once sentence.

    5. Re:Build a Database Driven Site -- Quick by Anonymous Coward · · Score: 0

      "Quick" is also an adverb.

    6. Re:Build a Database Driven Site -- Quick by rot26 · · Score: 1

      "Quick" is also an adverb.

      No, it's not. It's one of many adjectives that you can convert into an adverb by adding "ly" to the end.

      --



      To ensure perfect aim, shoot first and call whatever you hit the target
    7. Re:Build a Database Driven Site -- Quick by Anonymous Coward · · Score: 0

      Maybe its like the Apple slogan-"think different" not "think differently"

    8. Re:Build a Database Driven Site -- Quick by Anonymous Coward · · Score: 0

      Yes, it is. Look it up. Or just click this. Go to the bottom of the page where it notes that "quick" is also an adverb (not to mention a noun also). Notice the example it uses. "come here, quick." Sounds familiar, doesn't it?

      Consequently, "quick" and "quickly" are synonyms of each other.

    9. Re:Build a Database Driven Site -- Quick by Anonymous Coward · · Score: 0

      You are all wrong. "Quick" in its purest semantic meaning has absolutely NOTHING to do with pace, speed, etc.

      "Quick" in fact means the same as "alive" or "living". Hence the phrase "the quick and the dead" - not referring to the speed at which a cowboy can draw his revolver in increasing his chances of survival in a duel - as where I think this abuse of the English language came from. The phrase simply means: the living and the dead.

      There are countless examples of our language being manipulated (and raped) by idiots (the "politically correct" left-wing usually); "gender" is one such example - these fools use it to mean "sex" only "sex" doesn't include homosexuals, transexuals and other sexual deviants - so they engender a fundamental biological distinction. Don't use "gender". I know it seems petty but we can all resist this socialist abuse of our language. To assimilate a population - the first step is to manipulate their language. This is a grave concern.

    10. Re:Build a Database Driven Site -- Quick by Anonymous Coward · · Score: 0

      Notice the emdash. As punctuation, and in this case, it's used to conjoin 2 seperate statements, much like a colon or semi-colon -- allowing the author to combine two seperate but related thoughts into once sentence.

      Yeah, like we're going to take advice on spelling and grammar from somebody who can't spell. Beg, borrow, or steal a decent spellchecker AND USE IT.

  13. Re:Using PHP & MySQL to Build a Database Drive by lucabrasi999 · · Score: 3, Funny

    "Today's Database was Driven by the Letter S and the Number 5"

  14. Coding Standards? by codesurfer · · Score: 2, Insightful

    I wish these books would include a section or two on properly coding web apps and sites. Often people who begin coding with weakly typed languages such as PHP (not a knock against it) do not become familiar with proper design and memory management.

    1. Re:Coding Standards? by Anonymous Coward · · Score: 0

      I think it's safe to say that you don't have to use a weakly-typed language to NOT become familiar with proper design and memory management. I've seen plenty of C#/Java/'insert your favorite typed language here' code that was designed poorly, and ran just as poorly.

  15. This book's subtitle by Anonymous Coward · · Score: 0

    (Even though what you are building probably doesn't even need javascript, let alone a database)

  16. quicker to roll your own vs. pre-made by TeeJS · · Score: 2, Interesting

    I'm always amazed when books claim 'quick' web development with MySQL and PHP. I think the planning of data structures alone makes this a not quick process. With like a gazillion pre-made CMS's available for demo at OpenSourceCMS (http://www.opensourcecms.com/) wouldn't that be the 'quick' way to go?

    1. Re:quicker to roll your own vs. pre-made by eltoyoboyo · · Score: 1

      I suspect that the target audience of this book are the authors of every code offering on OpenSourceCMS.com

      I agree with you. Same goes for shopping cart sites and blog sites. Check out SourceForge for a gazillion more php/mySQL applications like bug trackers and portals.

      Then check out Nuke Cops to read up on the perils of mySQL/PHP in highly visible sites. They have logs of plenty of known exploits due to coding problems.

      --
      Have you Meta Moderated t
  17. Re:Using PHP & MySQL to Build a Database Drive by SupremeTaco · · Score: 3, Funny

    I guess they ran into the 46 character bug, wh

    --
    You have a constitutionally protected right to be wrong, and I the right to ignore you.
  18. I learned my PHP using Kevin Yanks tutorials by SpaceKow · · Score: 5, Informative

    I learned PHP using Kevin Yanks tutorials and articles 4 years ago. His books and tutorials are very easy to understand and use. His tutorials and articles can be read on http://sitepoint.com/

    1. Re:I learned my PHP using Kevin Yanks tutorials by Nos. · · Score: 1

      Not only that, but the forums on sitepoint are a great way to learn. I see (and answer) a lot of PHP questions there, and rarely do I ever see any type of flaming, even for the guys still learning to write their first "Hello World".

  19. Advertising by Anonymous Coward · · Score: 0

    I hope SitePoint is paying for all this advertising. That's like 3 book reviews in the past little while?

  20. Should make for Firebird by SirChris · · Score: 0

    They should make this with firebird sql and php. would be much more powerful.

  21. Re:Database Driven S! by emc · · Score: 5, Funny

    Remember the good old days when the /. mods would at least check the headlines before posting stories?

    No

  22. Database vs. XML Text Files by markmcb · · Score: 2, Interesting

    I recently threw together a rather Slashdot'ish site (http://www.omninerd.com/) and I used XML text files with PHP (and XSLT) over the mySQL alternative. Now, I'm no DB expert, but is there really any need for most sites to be DB driven? For example, on my site, there are articles, and the news posts that introduce these articles that readers can comment on. Perhaps I'm missing the big picture, but why would I need a DB solution when XML files get the job done, are easily portable, and can be accessed without the use of a DB program. I understand for extremely large data sets a DB is probably what you want, but what about small timers like me? Is a DB solution a waste of my time, or am I missing something big?

    --
    Mark A. McBride -- OmniNerd.com
    1. Re:Database vs. XML Text Files by prostoalex · · Score: 2, Insightful

      Two things that come to mind is search and scalability. Can you conduct quick searches through the files, and will the system scale if you become as popular as Slashdot, with thousands of daily updates (in form of user comments).

    2. Re:Database vs. XML Text Files by dreadlord76 · · Score: 2, Informative

      You are missing something.... Big...

      In a small database application, used by, let say, 500 users a month. There can easily be hundreds of thousands of records. Come end of month, you need to find 50 records out of 100,000 that meets certain criteria. How are you going to get that out of the XML text files? Read all 100,000 and then parse it?

      The fact that there may be 100000 text files out on disk should be causing all sort of alarms to go off.

    3. Re:Database vs. XML Text Files by C10H14N2 · · Score: 5, Interesting

      Indexing.

      Even on a very, very small dataset, do you want to run through n1*n2 or n1/n2 records? Very, very simple.

      Imagine: you're in the library of congress. You need not just ONE book, but *A* book with X in the title. So, what's the point of having a database? I mean, we've got all these books and all the information is like there and stuff...

    4. Re:Database vs. XML Text Files by neworbits · · Score: 1

      Well, I was a small-timer four years ago, but not planning on staying that way, I hired out the development, since books and onlne documentation reflect the utter inability of writers to sequence a series of steps in the natural order of an uninitiated person's need to know (except I suppose when it comes to vaulting their boogers).

      Once it was developed, I was able to grow from 100 products to over 3000, and now I am building a mirror site as a backup to the production site using what I see in the structure of the current one via phpmyadmin. That and consulting the programmer I originally hired have been far more instructive than any book or online documentation. And considering the time factor saved, it's actually costing less than trying to disentangle the usual convoluted book or documentation.

    5. Re:Database vs. XML Text Files by halosfan · · Score: 2, Informative

      If you truly want to understand this, read through the first couple chapters of the Date book

      For a brief answer, your XML files (and most OO databases as an extension) might work well for your application, but try using them for a totally different application that works with the same data. That's where relational model (at least in theory) shines: it is application-agnostic.

      Additionally, as your application grows and so is the number of concurrent users, you might face issues that are just not trivial/too tedious to program by hand:

      • Transaction support. For example, you transfer $5000 from your savings account to your checking account, and the power goes down when your savings account is debited but before your checking acount is credited. If you don't explicitly code around this problem, $5000 disappears.
      • Transaction isolation. Same example as above, but instead of power outage, a program that generates your paper statement is run -- $5000 is not on the statement, even though it is in your account.
      • Durability. Same example, power goes down. Try it enough times, and depending on which filesystem your XML file is on, you may well see it corrupted when you boot the machine after power is restored.
      • Consistency/integrity. Same example, your checking account balance is stored in a two-byte unsigned integer and is currently at $63,000...

      Try Date's book for more detailed (and likely more clear) explanation.

      --
      My only problem with Microsoft is the severity of bugs in their software.
    6. Re:Database vs. XML Text Files by C10H14N2 · · Score: 1

      But, wait, there's MORE!

      One poorly written query and you have the potential for a resultset of n^n. Even a modest 100,000 records could produce a query traversing a quadrillion records or more. If the person designing the application thinks that 100,000 XML files would be efficient, I have 100% faith that they would write something like:

      SELECT t1.x, t2.y, t3.z from onetable t1, onetable t2, onetable t3;

      ...now imagine their algorithm for doing that with said 100k XML files...

    7. Re:Database vs. XML Text Files by jc42 · · Score: 2, Informative

      Hmmm ... I wouldn't use slashdot as an example of searchable DBs. I occasionally try to find something with /.'s search thingy, hoping beyond hope, and invariably it fails me. Even if I give it a single word to find, it often returns articles that don't contain that word at all. If this is an example of mysql's search capability, I'll use something else.

      In my experience, (e)grep usually finds me a match much faster than SQL searches in whatever DB system we're using. I keep wishing this weren't true, but that's what the time(1) command tells me.

      (And google is better for finding /. articles than /. is. ;-)

      --
      Those who do study history are doomed to stand helplessly by while everyone else repeats it.
    8. Re:Database vs. XML Text Files by markmcb · · Score: 1

      Good point. And I didn't totally overlook indexing when I build the site. I have index files that cointain header like info for the files and make referencing not too bad. But I see how a database would be better.

      Question though: Is a database's indexing system much more efficient for searching through the body of hundreds of files if I'm doing some sort of content search?

      --
      Mark A. McBride -- OmniNerd.com
    9. Re:Database vs. XML Text Files by C10H14N2 · · Score: 1

      Generally, no, such "fields" aren't "indexed," in the usual sense of the term as they usually aren't even stored as "fields" at all. Building an "index" of, effectively, the entire contents of "War and Peace," wrapped it into a gargantuan string, well, that would be pretty useless...

      However, I would certainly trust the full-text search algorithms that took the collective incompetence of, say, Oracle or IBM to develop than my own singular incompetence. So, in that sense, yes, I would say there is an advantage, but not because the database structure itself is inherently any better for the purpose unless you did some pretty creative acrobatics with your data model in order to make life easier for the query optimizer. On the other hand, your existing metadata quite certainly would more efficiently used by an RDBMS than just traversing the whole lot start to finish every time.

    10. Re:Database vs. XML Text Files by capt.mellow · · Score: 1

      I've been toying with this very idea myself, more of curiosity than necessity. I've been doing php/mysql custom apps for the past 4 years, and I can do them very quickly and intuitively now--so it's gotten kind of boring/not-so-challenging. Learning to use XSLT/XML sounds like a lot of fun to try. I'd love to hear how you set things up (BTW your site looks nice).

    11. Re:Database vs. XML Text Files by markmcb · · Score: 1

      The basics of the site are covered in a short article I posted: http://www.omninerd.com/articles/articles.php?id=m cbride-200407-acasestudyindynamicwebdesign. If you want to get into the weeds on a particular aspect of the site, shoot me an email and I'd be happy to share.

      --
      Mark A. McBride -- OmniNerd.com
  23. The good ol' days by Tablizer · · Score: 2, Interesting

    In the early 90's many companies were working hard on data-centric products that took the grunt-work out of typical "CRUD" screens ("Create, Read, Update, Delete"). The leaders were probably PowerBuilder and Clarion, with VB and MS-Access barrowing some of the concepts to a more limited extent.

    The Web seemed to ruin this trend. CRUD screens via web forms is a pain in the glutious. Web standards were optimized for e-brochures, not business forms. Frameworks exist, but I have not found any that scale well in customization: if you need something outside of the framework, you are hosed.

    I wish the OSS community would work on producing more CRUD tools. If we have to toss HTML+DOM+JavaScript to get it, so be it. I think a remote-GUI protocol workable over HTTP is possible.

    Business development is so much smoother if you have good CRUD tools. Otherwise you spend all day reinventing the wheel and dealing with low-level annoyances. I know many slashdotters don't like dealing with CRUD issues, finding it boring or feel it lacks geek status or whatever, but there is a big business need for it. I am kind of a connoisseur of CRUD technologies (for good or bad), and the current wine is bitter.

    1. Re:The good ol' days by wackysootroom · · Score: 4, Informative

      The main problem with Clarion is that while it's easy to whip up a quick toy app, it plain dead sucks for anything more than an address book or recipe book with anything more than a couple of 1:many relations.

      Clarion was (at least from my experience with 5.0-5.5) riddled with bugs in it's QBE template and softvelocity's solution was to buy a template that fixes the problem from a third party until the next version comes out. No thanks.

      Another thing that pissed me off about clarion is that you would get buried in dialog boxes very quickly while clicking away at options with the mouse. Definetly not productive. Another fond memory I have is trying to figure out what event to use to do a certain action from the event model. The clarion community's response? Just keep trying different ones until you find one that works. I suspect that there's not one person who fully understands the event model.

      If it's CRUD you want along with maintainability and separation of business logic, view and data model. Try Ruby On Rails. You can literally develop a "toy" app 5 times faster in ROR than you could in clarion that does all of your CRUD stuff.

    2. Re:The good ol' days by Tablizer · · Score: 1

      A lot of tools don't bother to make their event handlers very visible or tweakable. A lot of GUI tools suffer from this.

      One solution I would like to see tried is clear priority rules with each event having an alterable priority. For example, field-specific validation events should normally fire before form-level ones. But one should be allowed to tweak a form-level (default) priority value if needed to make it fire first.

      And, it would be nice if traces of the events were loggable so that one could review them for debugging.

      I have proposed putting all the events and GUI widgets (or at least references to them) in a database so that one can query and study events in a consistent manner. But, some complain that this would make it too slow. I dispute that because FoxPro uses its semi-relational engine for some of such things, and it is generally pretty peppy. (However, a full-blown relational engine may have a different story.)

      I wish somebody would give me a grant to build such a contraption in full because I have been itching to do it.

    3. Re:The good ol' days by Anonymous Coward · · Score: 0

      Check out Ruby On Rails. Though personally, I think going directly against the database tables is kinda missing the point of a relational database.

    4. Re:The good ol' days by Anonymous Coward · · Score: 0

      You mean, like RubyOnRails?

    5. Re:The good ol' days by Anonymous Coward · · Score: 1, Informative

      As for CRUD web tools, you might want to take a look to 'ruby on rails' ( http://www.onlamp.com/pub/a/onlamp/2005/01/20/rail s.html)
      also recently featured on slashdot.

    6. Re:The good ol' days by Tablizer · · Score: 1

      Check out Ruby On Rails.

      I am suspicious of any GUI system that is tightly bound to a particular language. GUI systems should be mostly declarative, meaning that they can, or should, accomodate multiple languages. But I will put it on my "things to look into" list.

    7. Re:The good ol' days by Tobias+Luetke · · Score: 3, Informative
      If it's CRUD you want along with maintainability and separation of business logic, view and data model. Try Ruby On Rails. You can literally develop a "toy" app 5 times faster in ROR than you could in clarion that does all of your CRUD stuff.

      As a matter of fact I can confirm that this figure holds true for any size of application. I developed the e-commerce software powering www.snowdevil.ca 5 times faster then would have been possible without ruby on rails.

      This includes XMLRequest powered backend, inventory, order processing, credit card clearing, encryption and so on and so on and so on.

      Alone... in 3 months... while publishing an array of opensource tools and having fun doing so

    8. Re:The good ol' days by nuggo · · Score: 0, Troll

      Sounds like a job for Drupal!

  24. No mention of Security by kevin_conaway · · Score: 5, Informative

    The review didn't touch on security. I think that when you're trying to teach beginners and/or non-programmers how to build web applications, a good foundation on computer security principles is a necessity.

    Basic things like input validation and protecting against XSS are a MUST when dealing with PHP (or any language for that matter). Since beginners are the ones most likely to make these mistakes, it is important that they be educated now.

    1. Re:No mention of Security by Anonymous Coward · · Score: 0

      And the funny thing is, NOBODY seems to want to publish information about validating input across a whole application. How many times do we need to be told how to validate an email address? There must be a way to automate the process of determining how variables should be validated. Every application should be able to use the same basic validation routines so why does everyone have to use a different technique?

    2. Re:No mention of Security by Anonymous Coward · · Score: 0

      I completely agree with the parent post. The amateur programmers who write scripts with the goal to "just get it working" are giving the PHP language a bad name. A book that respects itself should include at least one chapter explaining in detail the main principles of the most common mistakes and how to avoid them:

      -don't trust the input
      -filter input
      -secure session handling (no session hijacking, etc.)
      -secure password handling

      Some resources I've found usefull are:
      http://ro.php.net/manual/en/security.php
      http://talks.php.net/index.php/Security
      http://pixel-apes.com/safehtml

  25. How to churn out vulnerable websites! by lukewarmfusion · · Score: 4, Insightful

    1. Buy a book about how to make database-driven websites.
    2. Find the sections that tell you how to get it working.
    3. Don't read any more about it.

    Two words: "SQL Injection."

    1. Re:How to churn out vulnerable websites! by Tablizer · · Score: 1

      Two words: "SQL Injection."

      If one is careful they can greatly reduce this risk. One trick is to put all read-only queries under a separate login from writable ones. This way no matter how tweaked the string is, the database won't do anything to change information.

      For writable queries, just have wrappers that check the validity and perhaps perform any quoting/escaping/validating that is needed. Example:

      $sql = "update x set foo=".sqlText($foo)." where xID=".sqlNumber($xID);

    2. Re:How to churn out vulnerable websites! by adolfojp · · Score: 1

      I see people writing security code everyday that can be broken by writting "something OR 1=1" in the password field. Yes, you might not corrupt or damage the data in that way but you will loose password protection.

      Cheers,
      Adolfo

    3. Re:How to churn out vulnerable websites! by Tablizer · · Score: 1

      I see people writing security code everyday that can be broken by writting "something OR 1=1" in the password field.

      PHP by default escapes quotes. I don't know of any way to cause a password string that un-escapes quotes, but I won't rule it out. Another thing is that pass-words should not contain any spaces. If you validate for spaces you further reduce the chance of SQL string hacking.

    4. Re:How to churn out vulnerable websites! by lukewarmfusion · · Score: 1

      Though I haven't had as much practice with PHP as with other scripting languages, my limited experience has always been that quotes were NOT escaped by default. Maybe a default php.ini has that set, but the host I was on did not.

      It's practically instinct to me now... I try some standard injection queries, add an apostrophe into querystring variables, etc. when I visit a new website. If I find something, I almost always send an email to the owner indicating that I found a problem and that they should look into fixing it.

      It's better to learn of your vulnerabilities from a friendly visitor.

    5. Re:How to churn out vulnerable websites! by adolfojp · · Score: 1

      The quotes were used to "quote". They are not part of the string. And you are right, passwords should not contain spaces. I know that, you know that, and all profesionals should know that... but they don't. ;-)

      Cheers,
      Adolfo

    6. Re:How to churn out vulnerable websites! by jschottm · · Score: 1

      And you are right, passwords should not contain spaces.

      It depends - having spaces allowed if your users are allowed to choose long sentences is generally a good thing. "I have a brown dog whose name is Alfred that is six years old." is an extremely effective password, provided your users don't mind typing that much. For some, the benefit of being easy to remember offsets the amount of typing.

    7. Re:How to churn out vulnerable websites! by adolfojp · · Score: 1

      That was rather insightfull and I hadn't thought about it as a viable solution! It is a lot easier for someone to learn "Waldo is in the 5th floor" than something like "2jhorlsh3", and possibly more effective.

      Everyday I learn something new. Thank you :-).

      Cheers,
      Adolfo

  26. Why MySQL and not PostGreSQL? (honest question!) by leoboiko · · Score: 4, Interesting

    No flames, please. I never really studied MySQL (other than installing, configuring, fiddling with Wordpress DBs, etc.), since my scholarship's teacher is a fan of PostGreSQL and I learned it first. Now I'm curious about why MySQL is so popular. Everytime someone is talking about a database-driven website it's Perl+MySQL, PHP+MySQL, Ruby+MySQL. What distinctive characteristics does it have over PostGres? Is it faster? Why do you like it so much?

    Someone said to me that it's simpler, but from the little that I tried they seemed to have pretty much the same complexity.

    --
    Prescriptive grammar:linguistics :: alchemy:chemistry. Stop being a nazi and learn some science.
  27. Zombie action and movie sites by zee_zack · · Score: 1

    Well I run a MYSQL and PHP movie site. It takes time to debug and build a list of films in the database, checking to make sure it is not of the same name. We interviewed some retro actors too. http://insomniacmania.com/ I have also written a crazy movie script that may interest some. http://insomniacmania.com/forum/viewtopic.php?t=20 05

    1. Re:Zombie action and movie sites by Anonymous Coward · · Score: 0

      How would you go about creating a detailed search engine for such a site using mysql? Pattern recognition code?

      Would you want to watch a film shot in the style of Pulp Fiction, based on games like 7th Guest and Vampire Hunter with Gillian Anderson as a female lead?
      http://insomniacmania.com/forum/viewtopic.php?p=10 008&highlight=#10008

  28. Mind your steps... by LuckyStarr · · Score: 3, Insightful

    1. Which language you use - be it Perl, php,
    whatever - is not important. Know the language you
    program in BEFORE you start the project! Almost
    all scripting languages have the database interfaces
    you need.

    2. Encapsulate recurring themes like database
    selects, inserts and so on. Knowing your language
    helps. Balance abstractness against usability.

    3. Use a (at least moderate flexible) template
    engine.

    Then youre (almost) done.

    In the last few years I used PHP and Perl. Both
    have their advantages and horrors. PHP is getting
    (even) better fast. Perl is quite nice if you know
    it good, which could take a little time.

    I only used MySQL and SQLite. MySQL with InnoDB is
    very reliable under heavy loads and huge datasets,
    but gets rather clumsy to back up and replicate.
    SQLite is blazingly fast, but I cannot say anything
    about reliability. I wont bet my crown-jewels on
    it (yet).

    Anyway. Good luck.

    --
    Meme of the day: I browse "Disable Sigs: Checked". So should you.
    1. Re:Mind your steps... by Anonymous Coward · · Score: 1, Insightful
      Know the language you
      program in BEFORE you start the project!

      Dunno about that, the only way I've ever been able to learn anything is by using it for an actual project. Seems to work out ok.

    2. Re:Mind your steps... by Anonymous Coward · · Score: 0

      3. Use a (at least moderate flexible) template engine.

      Unless you're using PHP. Then you already *have* a template engine.

    3. Re:Mind your steps... by LuckyStarr · · Score: 1

      This is just soooo plain wrong.
      is hardly what I call code-content seperation.
      I tried fasttemplate (normal and cached variant)
      and found it fitting for the most part. If you
      need more complex setups it bails out...
      management becomes too complex.

      You can get around that if you encapsulate the
      template library and build your own higher level
      libs.

      Smarty on the other hand is quite powerful, uses
      PHP to parse its code and fulfills content code
      seperation.

      --
      Meme of the day: I browse "Disable Sigs: Checked". So should you.
    4. Re:Mind your steps... by LuckyStarr · · Score: 1

      I would agree with you here, if the question would
      not be how to build a database driven site "Quick".

      For me a database driven site is complete if it is
      not vulnerable to sql-insertion attacks, does not
      fall appart if you change a bit of code in a random
      area and generally does not need human interaction.

      To get there fast, it is a prerequisite to have
      programmed before. Otherwise your site will be
      food for hackers or worms.

      --
      Meme of the day: I browse "Disable Sigs: Checked". So should you.
    5. Re:Mind your steps... by MikeBabcock · · Score: 1

      If you're using ZPT then you already have a template engine. PHP is a programming language that knows about HTML -- there's a big difference.

      <table>
      <tr>
      <th>Name</th>
      </tr>
      <tr tal:repeat="row here/row_list_py">
      <td tal:content="row/name">Name here</td>
      </tr>
      </table>

      Where "row_list_py" is a script that generates the data for you.

      For the non-Zope people: the 'tr' tag and its contents will repeat for each entry of the returned data from executing "row_list_py". The tal:content tells the 'td' tag to replace its contents with the value "name" from the current "row" object, as defined by the current "tr".

      --
      - Michael T. Babcock (Yes, I blog)
    6. Re:Mind your steps... by lachlan76 · · Score: 1

      the only way I've ever been able to learn anything is by using it for an actual project

      However I wouldn't use that project for anything too important ;)

  29. Does it cover appropriateness to task? by Matey-O · · Score: 3, Interesting

    I've seen _dozens_ of live database queries to fill a 'State' dropdown on a website... ...when was the last time we ratified a new state?

    I can't help but feel a lot of 'live instant all the time' sites would be a lot more efficient if it was 4 database calls a day, rather than Every Single Time Slashdot Hits Their Site.

    --
    "Draco dormiens nunquam titillandus."
    1. Re:Does it cover appropriateness to task? by Anonymous+Custard · · Score: 1

      I've seen _dozens_ of live database queries to fill a 'State' dropdown on a website... ...when was the last time we ratified a new state?

      Even a static file that's updated when needed would be sufficient and better than live hits to the database.

    2. Re:Does it cover appropriateness to task? by Tablizer · · Score: 1

      I've seen _dozens_ of live database queries to fill a 'State' dropdown on a website... ...when was the last time we ratified a new state?

      With Bush in office, we should be ready for all kinds of changes, such as a Civil War between red and blue states; Iraq, Iran, France, and/or N.Korea being added, etc. :-)

    3. Re:Does it cover appropriateness to task? by Anonymous Coward · · Score: 0

      've seen _dozens_ of live database queries to fill a 'State' dropdown on a website

      Lazy developers do this because they don't want to have to copy and paste the options from page to page. :)

    4. Re:Does it cover appropriateness to task? by Anonymous Coward · · Score: 0
    5. Re:Does it cover appropriateness to task? by Xeth · · Score: 1

      when was the last time we ratified a new state?

      Perhaps a little more often than we change centuries? But that's never caused problems before...

      --
      If your theory is different from practice, then your theory is wrong.
    6. Re:Does it cover appropriateness to task? by Canberra+Bob · · Score: 1

      Lazy developers realised long ago that include() takes far less thinking for tasks such as this than copy / paste or 10 SQL queries :)

    7. Re:Does it cover appropriateness to task? by Anonymous Coward · · Score: 0

      That would be great. The rest of NY hate NYC anyway.

    8. Re:Does it cover appropriateness to task? by capt.mellow · · Score: 1

      Thanks for bringing up that point. I found this: http://us2.php.net/manual/en/ref.memcache.php

    9. Re:Does it cover appropriateness to task? by jschottm · · Score: 1

      I believe that the point was that the same task could be accomplished by simply reading in a plaintext file much faster than it could by pulling it out of the database. Databases are great for producing related data, but basic configuration is better kept in text/XML/whatever files. (Note that I'm not saying that you shouldn't have a listing of the states in the database, just that you shouldn't use that to generate a select box.)

  30. be quick or be dead by aled · · Score: 1

    Many Web designers don't have deep knowledge and experience in data coding but want to get started serving up dynamic Web pages.

    When I read this kind of article I can't help but feel shudders. I wouldn't touch one of this sites even with a disconnected PC.

    --

    "I think this line is mostly filler"
    1. Re:be quick or be dead by gandy909 · · Score: 1

      Unfortunately, you probably touch many of them every day if you do much browsing!

      --

      (Stolen sig) Remember: it's a "Microsoft virus", not an "email virus", a "Microsoft worm", not a "computer worm
  31. Better book idea by JeffHunt · · Score: 4, Insightful

    "Build a Database Driven Site - With a Skilled Contractor Who Actually Knows What He's Doing"

    Just a thought... :)

    --

    "It was hell!" recalls former child.

  32. Watch your server go up in flames, QUICK! by C10H14N2 · · Score: 4, Interesting

    Connection pools are your friend... and rather hard to use without an app server, which kinda spoils all the fun of writing PHP, the point of which is generally being able to avoid having to use one in the first place.

    Unless you have a limitless supply of CPUs+RAM, you're going to need connection pooling very, very quickly. Frankly, they're so easy to use, I don't understand why anyone would bother coding a database app without them.

    But, for a beginner, this seems to cover some of the more important structural aspects of RDBMS in relation to webapps, not just "look, ma, it's dynamic!" Most of the books out there I've seen seem to just assume you know what you're doing on the SQL side of things and just focus on the PHP/JSP/Whatever side of things, which is just a death sentence for a beginner who has never touched a SQL server...

    1. Re:Watch your server go up in flames, QUICK! by frn123 · · Score: 1

      Isn't that just writing mysql_pconnect instead of mysql_connect in php. And i'm quite sure that there's a Apache::Something module for mod_perl that does the same.

    2. Re:Watch your server go up in flames, QUICK! by Tablizer · · Score: 1

      Isn't that just writing mysql_pconnect instead of mysql_connect in php. And i'm quite sure that there's a Apache::Something module for mod_perl that does the same.

      A word of warning: for bigger PHP apps, create wrapper functions for connections, queries, etc. so that you can switch the implementation without having to change a bunch of code. Thus, have a function called "DB_connect", and whether inside it uses mysql_connect, mysql_pconnect, Oracle_connect, etc., is only an implementation detail.

    3. Re:Watch your server go up in flames, QUICK! by Anonymous Coward · · Score: 0

      no no, using mysql_pconnect on apache 1.x is called "Error: Maximum number of connections in use", since every copy of the httpd will have its own mysql connection pool and you will run out FAST. Great if you want to divert traffic from a slashdotting (people will take pity on you and post your site text on /. then. If your site is doing well, you'll just have to suck up the charges). Bad if you actually want more than a few thousand people to read your site at once.

    4. Re:Watch your server go up in flames, QUICK! by C10H14N2 · · Score: 1

      Sure, but, erm, and where would the pool be held?

      I suppose under WAMP (as opposed to LAMP) you could shoehorn ODBC into performing "pooling," but, oy vey, I wouldn't wish that on my worst enemy.

    5. Re:Watch your server go up in flames, QUICK! by drew · · Score: 1

      funny, i always thought it was called "learn how to change 'max open connections' in your database configuration"....

      --
      If I don't put anything here, will anyone recognize me anymore?
    6. Re:Watch your server go up in flames, QUICK! by Saeed+al-Sahaf · · Score: 1

      I really think that most people are aware of database abstraction layers.

      --
      "Who are in control, they are not in control of anything - they don't even control themselves!" - Glen Beck
    7. Re:Watch your server go up in flames, QUICK! by Anonymous Coward · · Score: 1, Interesting

      are they?

      The why do so many PHP applications only support MySQL, with PostgreSQL supoort coming "Soon".

      PHP actively discourages the use of database abstraction layers, because those that spout off about how easy it is show the mysql_* functions as their prime example.

      The day that the mysql_* functions are marked deprecated, or removed and replace with a proper database abstraction layer that is promoted as heavily as the mysql_* functions are now, is the day that I'll admit that PHP is a language a new programmer should learn.

      PHP encourages bad design because PHP is badly designed.

    8. Re:Watch your server go up in flames, QUICK! by Saeed+al-Sahaf · · Score: 0, Flamebait
      Bullshit. PEAR has db abstraction ADODB is widely used. There are others as well. All are in wide use. One reason that PostgreSQL is not widely used with php applications is because it is not commercially supported, and this has nothing to do with PHP or abstraction layers.

      Your clear bias is blinding you, so there is no point in talking to you.

      --
      "Who are in control, they are not in control of anything - they don't even control themselves!" - Glen Beck
    9. Re:Watch your server go up in flames, QUICK! by Anonymous Coward · · Score: 0

      Ever used MySQL on a large site? With it, unlike with Oracle, Informix, or PostreSQL that I've used, you don't need connection pooling. Each connection to a MySQL server takes so little overhead that you can create as many connections as you need. We have a site running on a Pentium III 450 with 256 Mbytes of RAM that often has over 200 simultaneous connections at one time. This server handles about 4 million hits per day, so lack of connection pools just isn't a problem.

  33. Please don't use direct connect by just+someone · · Score: 3, Insightful

    And teach people how to abstract connection information in a separate page.

    A whole bunch of items are about to break beacuse people need to use mysqli. It would have been nicer if all these hacks used some db abstraction layer.

    And anyone who has had to update some pages a newbie built, will say please learn to abstract the connection information into a single page, not one connection per page.

    Ayeee.

    1. Re:Please don't use direct connect by GeneralTao · · Score: 1

      I'm interested. Can you expand on that?
      I am just getting started with this kind of stuff.
      Do you mean that I should learn how not to make each load of a self-referencing php file establish a new connection?

      How do I do this abstraction you're talking about? I presume it involves session IDs or some such? Any info would be appreciated.

      --
      --- Tao
    2. Re:Please don't use direct connect by Qzukk · · Score: 1
      In programming, abstraction generally means "call a function" though when you're talking about abstracting a group of functions it means "make a class".

      In this case, he's saying write
      function connect_to_the_damn_database() {
      $user="foo";
      $password="foo";
      $dbname="foo";
      $handle=real_connection_function($user,$password,$ dbname);
      return $handle;
      }
      in dbfuncs.php or something, then using require_once("dbfuncs.php"); $handle=connect_to_the_damn_database(); in all the other files.

      This way when your password changes you change dbfuncs.php. (btw, you end it in .php so the webserver won't show the password to anyone who guesses the location of the file and tries going there directly. By default, .inc files are treated as plaintext by the webserver.)
      --
      If I have been able to see further than others, it is because I bought a pair of binoculars.
    3. Re:Please don't use direct connect by papasui · · Score: 1

      Or a better idea is to place your file with passwords in a directory not web accessible and then include the path to it instead. require_once("/usr/local/src/webapp/dbfuncs.php");

    4. Re:Please don't use direct connect by Anonymous Coward · · Score: 0

      Practical when you're writing something for yourself, highly impractical when you're writing something for deployment on thousands of other webservers which may or may not have a /usr/local.

      A Compromise would be to use a relative path and tell users to make the Document root foo/ then have app.php include ../includes/dbfuncs.php, but then you run into php's shitty relative path handling.

  34. What PHP really needs by ShatteredDream · · Score: 3, Interesting

    Is something analogous to Web Forms. It'd be a great way to encourage people to work towards XHTML compliance if they could write some really slick UI with PHP and "PHP Web Forms" that could be manipulated directly from PHP rather than processed as a regular HTML form.

    Then again, I suppose working namespace support is probably a more pressing concern at this point.

  35. Build a Database Driven Site -- Quick? by mr_zorg · · Score: 1

    Maybe we should focus on building a site well, not quick? How many PHP/MySQL driven sites have you been to only to be greeted by error pages? Note that I'm not blaming the technology, only those who put them together "quick" and "easy"...

    1. Re:Build a Database Driven Site -- Quick? by Anonymous Coward · · Score: 0

      "How many PHP/MySQL driven sites have you been to only to be greeted by error pages?"

      Why, every one that Slashdot links to, of course.

  36. McDonalds... by Spy+der+Mann · · Score: 1

    And contrarily to popular opinion, Microsoft is not McDonalds ;-)

    Well they DO fit the "Supersize me" theme :)

  37. Re:Why MySQL and not PostGreSQL? (honest question! by danieljpost · · Score: 3, Informative

    I'll bite. Mysql installs & runs on Windows without any third party software. (Yes, the Web really runs on Linux. I know, I know.) PostGreSQL seems to run on Windows only in emulation (via Cygwin). Also, there used to be very slight performance differences (in terms of maximum numbers of hits to the DBMS per second, on simple benchmark datasets), and people seem to enjoy the idea that someone the same box could take 20,000+ hits in an hour using Mysql rather than 19,000 on the same hardware using PostGreSQL. This was a couple years ago so could be completely wrong now. I think there might also be a perception that MySQL is easier to use than PostGreSQL (based, I think, on pronunciation of the name). Plus, Slashdot uses MySQL. Those are the reasons I can think of. YMMV.

    --
    We must drive a sword through any hypothesis that is not strictly necessary.
  38. It's a simple, solid DB. by TheLittleJetson · · Score: 1

    MySQL installation is pretty brainless. Unpack the archive, tweak the config file, start it up, and create your users.

    It's pretty fast, very stable, and has an excellent front-end available. Basically, it does the job, and it does it well. There are certain advanced DB tasks that you might need a more robust SQL implementation for, but for general purpose DB work, there's really not much reason to use anything else.

    PostgreSQL is awesome, but last time I set it up, it was definately more work than MySQL.

    1. Re:It's a simple, solid DB. by Anonymous Coward · · Score: 0

      MySQL installation is pretty brainless. Unpack the archive, tweak the config file, start it up, and create your users.

      And exactly how does this differ from PostgreSQL?

    2. Re:It's a simple, solid DB. by Anonymous Coward · · Score: 0

      *sigh* I made it so far down the page without any zealotry. Could you point out where grandparent said it's *not*? No, didn't think so :\

    3. Re:It's a simple, solid DB. by Anonymous Coward · · Score: 0

      > for general purpose DB work, there's really not much reason to use anything else.

      Until, of course, you start wanting features in a real database. Like views. MySQL still doesn't have views.

      But hey if all you want to to is store your recipes, I guess MySQL beats using ndbm with C...

    4. Re:It's a simple, solid DB. by Anonymous Coward · · Score: 0

      Read the last sentence of that grandparent. It was implied.

  39. YAPHPAMYSQLB by Anonymous Coward · · Score: 0

    Yet Another PHP And MYSQL Book. Good-Fucking-God. Mysql sucks ass.

  40. Re:Why MySQL and not PostGreSQL? (honest question! by sfritzd · · Score: 1

    I don't think it has to do so much with complexity or simplicity or anything like that, but actually more to do with the appearance of simplicity. MySQL has a ton of really good documentation in many places on the web, whereas Postgres has a crappy online manual that even folks with years of experience with other dbs find confusing (like, um, me).

    Also, for select intensive applications MySQL is faster. And you don't need to worry about optimizations like you need to with postgresql. Vacuum? I don't even do that to my house.

  41. Re:Why MySQL and not PostGreSQL? (honest question! by alienmole · · Score: 1

    MySQL started out a lot simpler - actually quite severely limited compared to PostgreSQL - but its simplicity is part of what attracted a large community. The community created network effects which have a lot to do with MySQL's continued dominance - more people are familiar with it, more packages already use it, so it makes sense to pick it for new projects, especially now that many of its original limitations have been overcome.

  42. Re:Why MySQL and not PostGreSQL? (honest question! by Silas · · Score: 1
    Here's some research my company put together on why PostgreSQL is better (for us, and for web app development, anyway) than MySQL and others. We couldn't find any such comparison in existence when we looked, so I hope it's useful to someone, and we certainly welcome comments.

    Silas

  43. Re:Why MySQL and not PostGreSQL? (honest question! by JohnsonWax · · Score: 3, Informative

    mySQL is popular now because every hosting firm offers it as an option, but Postgres is far less common.

    Further, most web service add-ons (CMS, forums, etc.) are mySQL based out-of-the-box so it has become the platform on which to build.

    You'll notice there are no technical reasons there - as RDBMS go, mySQL is pretty horrible. It's the Windows of free databases, as it were.

  44. A PHP developer's review by Spy+der+Mann · · Score: 1

    Let's get things straight. This book is for newbies or for those who want a quicksearch reference. After all, what non-newbies title doesn't include "build your own"? (For more advanced users, I recommend the PHP Anthology which deals with more complicated stuff, like FTP, thumbnail generation, search engine friendly urls, etc.)

    I began programming in PHP+MySQL around 2 years ago, and this book practically taught me everything.

    The book had a nifty section on administrating your MySQL database (specially useful when you forget your password :-P ). But the part that has helped me the most is the reference (Appendices).

    Appendix A: MySQL syntax (with all the optional parameters)
    Appendix B: MySQL functions. For example, what command do we use to search a substring in mysql? Quick search Appendix B... there! LOCATE.
    Appendix C: MySQL column types. I don't use MySQL commands often, except when I add a module to my PHP framework (programmed by myself). so when I want to know how to specify a certain type, it's all there.
    And finally, Appendix D: PHP functions for working with MySQL.

    When you have read this book and have it in your office drawer, flipping thru some paper pages is definitely much faster (at least for me) than typing the search terms on the keyboard. So I recommend it to anyone wanting to learn PHP and MySQL. And to anyone who wants a reference handy :)

    (off-topic Grammar Nazi hint: It's "waste", not "waist". Waist is what you get when you waste too much money on junk food)

    1. Re:A PHP developer's review by MBraynard · · Score: 1
      But the part that has helped me the most is the reference (Appendices).

      Appendix A: MySQL syntax (with all the optional parameters)
      Appendix B: MySQL functions. For example, what command do we use to search a substring in mysql? Quick search Appendix B... there! LOCATE.
      Appendix C: MySQL column types. I don't use MySQL commands often, except when I add a module to my PHP framework (programmed by myself). so when I want to know how to specify a certain type, it's all there.
      And finally, Appendix D: PHP functions for working with MySQL.

      Like I said. Waste of money. Those are sections in the free, downloadable .chm helpfile that YOU CAN PRINT OUT and put in your desk.

      Maybe this really does work. I should find some well-documented OSS software, put my name on it, and try to sell it to folks like you.

    2. Re:A PHP developer's review by rjshields · · Score: 1

      What am I going to do with a .chm help file on unix? Has microsoft help been ported?

      --
      In this world nothing is certain but death, taxes and flawed car analogies.
    3. Re:A PHP developer's review by MBraynard · · Score: 2, Informative
      See, here is why the book stinks compared to online. Obviously they have formats that are friendly not just to all OSes but also many languages.

      Take a look here

      Notice that there are notes. User notes. Those are often more valuable to me than the documentation. No book has those. That is why the online/print it out solution is infinitly better.

    4. Re:A PHP developer's review by kv9 · · Score: 1

      What am I going to do with a .chm help file on unix?

      youre gonna open it and read.
  45. RoR is gaining traction by 5n3ak3rp1mp · · Score: 4, Informative

    Coming from some work in PHP, I've been burying my head in Ruby lately, to much joy, and have also discovered Ruby on Rails, which was also featured in a recent Slashdot article. What I've seen is amazing so far (not to mention that Ruby code is so much more readable than PHP that it's not even funny). Just an FYI...

    1. Re:RoR is gaining traction by orion024 · · Score: 1

      Agreed. I have a website which I originally designed in PHP with a MySQL backend. After one too many PHP headaches, I ported the site to eRuby/mod_ruby. It was a fraction of the code and much more readable. And *now*, with porting to Ruby on rails, I am cutting the code down even more. I won't touch PHP now unless I absolutely have to.

    2. Re:RoR is gaining traction by Anonymous Coward · · Score: 0

      Ditto.

      Rails is like a collection of "best practices" all wrapped up in a nice box.

      If you're a PHP programmer, and you try Rails, you'll think, "wow, why the fuck was I wasting all this time?"

      If you are a newbie and you're thinking of "learning PHP" because it's "teh p0pular!!!!", try Rails *FIRST*. Then if you still think PHP is worth your time, go back and learn it.

      Seriously.

      Just try Rails.

      Even if you never use it, at least you might be inspired to make your own code a little more dynamic, a little more agile, a little more simple.

  46. Re:Why MySQL and not PostGreSQL? (honest question! by sloanster · · Score: 1

    Now I'm curious about why MySQL is so popular

    Two words: blazing fast.

    I first compared mysql and postgres in the 1999 era, and found mysql to be like a stripped down hot rod, fast and without frills, though fun to use. Postgres was like a classic cadillac in comparison. Large, ponderous, full of features and amenities. But when it came to performance, mysql just blew postgres out of the water. I ran a number of benchmark tests, and in some cases postgres and mysql were fairly close, while in other tests, postgres took 10 times as long as mysql. In a number of the tests, postgres couldn't finish in a reasonable time, so the results were interpolated.

    Postgres fans pointed out that what with all the features and sophistication of postgres, it wasn't fair to benchmark it against mysql.

    Fast forward to January 2005. Postgres has gotten faster, while mysql has gained features such as subselects, row-level locking, transactions and more. I ran the sql-bench test suite against mysql 4.0.22, and postgres 7.4, both completely stock, with default configurations as shipped with suse 9.2.

    As it turns out, mysql was still an order of magnitude faster on some tests, while mysql and postgres were close on only a few of the tests.

    I find mysql extremely easy to work with, as well as being lightweight. There's a reason that Mysql is the M in LAMP, after all.

  47. Re:Why MySQL and not PostGreSQL? (honest question! by egoots · · Score: 2, Informative

    Mysql installs & runs on Windows without any third party software. (Yes, the Web really runs on Linux. I know, I know.) PostGreSQL seems to run on Windows only in emulation (via Cygwin).

    This is no longer true! PostgreSQL 8.0 was recently released and one of the main feature enhancements is a Win32 Native Server

  48. Re:Why MySQL and not PostGreSQL? (honest question! by egoots · · Score: 1

    "As it turns out, mysql was still an order of magnitude faster on some tests, while mysql and postgres were close on only a few of the tests."

    Which table type was used in the the default MySql setup?

  49. DB::File by Anonymous Coward · · Score: 0

    Perl has built in database support. Why use SQL at all?

  50. No "Hello, World!" ?????? by Anonymous Coward · · Score: 0

    I'll save my money, thank you!

  51. If I were to do this... by FirstTimeCaller · · Score: 1

    I'd be more inclined to using Ruby on Rails.

    I was impressed with what I saw when... a lot of bang for very little code.

    --
    Wanted: witty unique signature. Must be willing to relocate.
  52. Perhaps an ebedded database? by SuperKendall · · Score: 1

    So you mean something like an embedded DB, that every time an event was fired would note the event and also the generating UI element in such a way that something else could ue it to work backward to the UI element?

    I also agree that it would be nice to expose the event handlers more in GUI development tools, instead of requiring you to go through layers... it really seems like a lot more could be done to visualize GUI layout along with behind the scene components together than has been done up until now. What we have is WYSIYG, but not WTHWHH (What The Hell Will Happen Here).

    --
    "There is more worth loving than we have strength to love." - Brian Jay Stanley
    1. Re:Perhaps an ebedded database? by Tablizer · · Score: 1

      So you mean something like an embedded DB, that every time an event was fired would note the event and also the generating UI element in such a way that something else could use it to work backward to the UI element?

      Yeah, kind of like a RDBMS "trigger" that is programmed to (optionally) write to a log table.

      it really seems like a lot more could be done to visualize GUI layout along with behind the scene components together than has been done up until now. What we have is WYSIYG, but not WTHWHH (What The Hell Will Happen Here).

      Using a database better divorces meaning from presentation. Thus, one can view the events, event logs, and GUI info any way they please. In fact ideally one could use the tool's very own query, browsing, reporting, and GUI tools to build custom viewings of such info. It will require an understanding of the GUI model and related schemas, but once you know that your viewpoint is purely whatever you want it to be rather than only whatever the wizards that happen to be in the box allow.

  53. Re:Using PHP & MySQL to Build a Database Drive by Anonymous Coward · · Score: 0

    I'm gonna go out on a limb here and say that the person who modded this down completely missed the point -- namely, that when this topic was born, it had a different title that was truncated.

    I thought it was funny, myself. *shrug*

  54. "Building" ? by Anonymous Coward · · Score: 0
    MySQL and PHP installation on Windows

    I'm sorry, was that title "Build a Database Driven Site" or "Hack into someone else's Database Driven Site"?

  55. Do the same thing with 10 Minutes work by MatthewNewberg · · Score: 3, Insightful

    Find a web host online that has PHP, MySQL and will autointall scripts for you. One such good one is http://secure.lunarpages.com/tracking/cgi-bin/clic kthru.cgi?id=mnewbe2 Purchase Webspace Login and click the Mambo installer button. Done - You Now have a PHP/ MYSQL Web Site Or you can just install Mambo yourself http://mamboserver.com/ That is my suggestion for a QUICK way to do it.

  56. Save the Adverbs, Quick! by lildogie · · Score: 2, Funny

    I suppose they're archaic now.

  57. Four Sample Chapters for this book by Anonymous Coward · · Score: 2, Informative

    The publisher is offering 4-sample chapters in PDF Format for this book on their Website: SitePoint.com/books/phpmysql1/ - It's definitely more useful in helping me make a decision than reading through a Table of Contents or Index, at least for me.

  58. Re:Why MySQL and not PostGreSQL? (honest question! by drew · · Score: 3, Informative

    i think it's mainly tradition. mysql was fast, stable, and usable for basic sites long before postgresql. mysql gained a lot of mindshare early on, when they were the only free game in town (as far as most people knew anyway). while postgresql was focused on correctness first, and speed and ease of use only later, mysql was fast and simple to get working almost from the start, and most people didn't know or care why they wanted ACID in a database. now, some six years later, postgresql is mostly a match for mysql in speed, and mysql has added a lot of the 'real' database features that they were criticized for not having early on (although some of us will still not forget their attitude towards implementing them). there's not nearly as much reason to choose one over the other anymore as there used to be, but mysql had the advantage of early mindshare, so all of the websites talk about LAMP, and all of the books talk about "how to do X with mysql".

    personally i would never use mysql for data that i didn't want to risk losing, although i have no doubt that it has improved substantially since the last time i had the pleasure of using it. but that's just me.

    --
    If I don't put anything here, will anyone recognize me anymore?
  59. Re:Why MySQL and not PostGreSQL? (honest question! by Anonymous Coward · · Score: 0

    You'll notice there are no technical reasons there - as RDBMS go, mySQL is pretty horrible.

    What a broad fucking statement to make without any facts. Grandparent asked a good question for once about comparing the two, and you zealots *still* have to bitch. Come on man.

  60. Re:Why MySQL and not PostGreSQL? (honest question! by sloanster · · Score: 1

    Which table type was used in the the default MySql setup?

    The default MyISAM tables were used.

    I'll test again using the more capable innodb tables when I get a chance...

  61. Re:Why MySQL and not PostGreSQL? (honest question! by dema · · Score: 2, Interesting

    personally i would never use mysql for data that i didn't want to risk losing

    I hear that a lot without much to say beyond it. But it seems like everytime MySQL and pgSQL come up it's hard to wade through all the zealotry and bs to find any real answers. What exactly do you (and presumably others) base your lack of trust in MySQL's data storage on? I've seen a few personal accounts about how MySQL has f'ed up and lost people's data, but do you know what kinds of things lead up to that? Or, why it would be more likely under MySQL than any other database?

  62. Doesn't everbody know? by galenoftheshadows · · Score: 2, Funny

    It's more fun to tear your hair out trying to figure out what went wrong! :-P

  63. Update is in order by WebCowboy · · Score: 4, Insightful

    This was a couple years ago so could be completely wrong now.

    No completely wrong, but mostly:

    * The current release of PgSQL runs natively on NT/2K/XP/2K3 Server as a service. The Cygwin emulation and related kludges are not an issue with either database now.

    * PgSQL has been quite optimised in recent years, while at the same time MySQL has become rather less lightweight than it used to be. The only way to get any measurable performance benefit from MySQL over PgSQL now is to forego the use of InnoDB tables in MySQL (and the transactional ACID-compliancy/rollback capability that comes with them). Even then, it is only fast at SELECTs--speed of INSERTs, UPDATEs and DELETEs was never MySQLs real strom point in any case.

    * As far as volume of hits and concurrent users go, PostgreSQL is far superior because it has a mature, stable MVCC (multi-version concurrency control) solution that almost completely eliminates table and record locking. If you have a site that does frequent and random insertion, deletion and modification transactions PgSQL wins.

    * MySQL was perhaps simpler in the past, but that was because it's capabilities were much more limited. It isn't hard to use today, but it isn't exeptionally easy anymore. Furthermore, PgSQL has a lot more tools to ease administration tasks than it used to. I am puzzled by comments that PgSQL us hard to use--I actually find it is easier to use than MS SQL Server 2000 now. The documentation has come a very long way and you can point-and-click your way around PgSQL with PgAdmin, WebMin, and various PHP web-based tools.

    * There are a lot of large-scale PgSQL implementations that rival or exceed Slashdot in scale. The entire .org domain relies on the PgSQL platform for example.

    Anyways, I hope I haven't offended MySQL fans--it is a fine product and has enjoyed a great deal of success and advancement with its association with SAP for example. For a typical blogger/slashdot-style site MySQL fits the bill nicely as it has the largest installed base, doesn't handle mission-critical data, and the vast majority of activity is read-only.

    If the data in the application is *important* and is write-heavy then you'll find that the case is different than above. For mission-critical web-based systems PostgreSQL tends to be be chosen over MySQL. For example, the SQL-Ledger accounting system uses PgSQL and NOT MySQL. However, MySQL has grown up some and has become a viable option here too--it's just that PgSQL has a more established image as being not the fastest but themost reliable with your data.

    Just remember that if you decide to pass on InnoDB to max out performance of your MySQL database you better make damn sure you have a reliable UPS and don't trip on the power cord or bump the emergency power disconnect switch or you'll have a crisis on your hands...

    1. Re:Update is in order by packman · · Score: 2, Insightful

      I agree that from the moment you need transactions & stuff or a seriously complicated database, you need Postgres. I'm not a Mysql fan at all, I use the best tool for the worst job but for web applications I seriously doubt Postgres has any chances in the mass-market because:

      1) Mysql has a much smaller memory-print. Try giving a database 4 or 8mb or ram to work with in both Postgres and Mysql and compare the performance. Postgres loses BIG time, while mysql runs without a glitch. Postgres is nice if you have 1 server dedicated to 1 application. Mysql is so popular because for low-end sollutions, it uses very little resources, which is exactly what mass-hosting companies need. Why do you think you see so little web-hosting with Postgres support?

      2) 95% of the queries performed by websites are typicly SELECT's - which is Mysql's strongest point.

      3) Most websites are not mission-critical. If you lose data - too bad, that are some blog's you lost, or maybe some reactions... Big deal. Btw - postgres's recovery after a powerfailure isn't perfect, I know a company that is switching to Oracle after a small postgres disaster half a year ago... They lost a rather critical table with +- 7 million records, and daily thousands are added.. Backup was from the day before, but they lost a whole day of pritty important transactions (crash happened at 21u in the evening, backup started at 21u30). No system is perfect, but now they have someone to blame...

      4) Postgres's duplication can't tip mysql's. In postgres quick hacks are available, Mysql supports load balancing and mirroring over multiple servers by default, and it's far superior to anything Postgres has.

      5) Postgres should be optimized for 1 application. There is no generic optimal configuration, differences in performance between applications can be extreme depending on the configuration.

      Mysql has it's purposes, so does Postgres, but I don't think they are competitors actually. It all depends on what you really need. I have experience with both, and for web-purposes - Mysql please... I plan looking into SQLite, which I already use for embedded purposes, but don't know how that is going to react in a multithreaded environment like a webserver.

  64. PEAR? by drew · · Score: 4, Interesting

    so, now that PHP actually has a complete, functional, and, most importantly, built in database abstraction layer, why are they still teaching people to use mysql_connect/query/etc?

    shouldn't everyone be using PEAR::DB by now?

    bad news when you decide you want to change your database because mysql can't handle the load without munging your data anymore....

    (ok, so the jab at mysql was flamebait, but the rest is a serious question....)

    --
    If I don't put anything here, will anyone recognize me anymore?
    1. Re:PEAR? by Dr.Knackerator · · Score: 1

      yep you are right. DB and the HTML form stuff from pear covers most of your ass for doing web/db. after writing the 1st page its just cut&paste of the guts from then on

    2. Re:PEAR? by hacker · · Score: 1
      "...because mysql can't handle the load without munging your data anymore...."

      Unless you have some real world data to back this up, your statement is 100% pure FUD. MySQL does not corrupt data under load, at all. If you have load problems with MySQL, the problem isn't MySQL. MySQL will keep on running no matter how much load you throw at it. This isn't MySQL 2.0, you know.

      I've had a heavily hit MySQL backed website on a Linux box with a +78 load at one point (a cron job spiraled off and spun the system up so high I could barely log into the console). MySQL kept on chugging, and there was no corruption in any of the 23 very large databases running on it.

    3. Re:PEAR? by drew · · Score: 1

      i admitted at the end of the post that the statement in question was meant in jest. regardless of my inflammatory statement, there are many reasons that you may want to change what database you are deploying your application on someday, and when that day comes, you will be awfully sorry if you wrote all of your database code using database specific libraries (e.g. mysql_query(), etc.) rather than a database independent api (e.g. PEAR).

      for 99+% of database developers, there is no reason whatsoever to not use a database abstraction layer over a database specific library. and if you are using mysql, or any other open source database for that matter, there's a very good chance you are not in the other 1%.

      that being said, i worked in the critical systems team (roughly equal to systems administration) of a company that served 6 billion requests per month off of 16 mysql databases hosted on big beefy sun enterprise boxes. i don't recall exactly, but i believe we were using 3.23 or something around there. we used mysql because oracle wasn't fast enough to handle our traffic, so i do know a bit of what i'm talking about when it comes to running mysql databases under load.

      --
      If I don't put anything here, will anyone recognize me anymore?
    4. Re:PEAR? by packman · · Score: 1

      Let's turn that around now - play advocate of the devil :)

      How many people develop a web application that will be run by multiple persons, on multiple servers with different database engines? If you have an ordinary website which has only mysql support - that is no problem - since any PHP hosting i've encountered offered mysql support.

      Database abstraction is good when you have a product or software package that should be distributed, but the vast majority of PHP-enthousiasts, for which this book is intended won't need another database than Mysql. In the future this may be SQLite - but time will tell...

      Also - database abstraction doesn't work very well anyway. A big problem is differences in SQL between database engines - which is still present. Sollutions for this are simply too complicated for a simple web-application...

    5. Re:PEAR? by drew · · Score: 1

      You still didn't answer my original question. Is there any advantage in PHP to use the mysql_* functions rather than the PEAR::DB library? Even if you don't expect to ever have to change the database you are using?

      I realize that there are differences in the query languages that no (reasonable) abstraction layer can accomodate, but isn't it still better to have one consistant API to program with?

      Even if a reader of this book will never move his current web page off of its MySQL database, what if the next website he works on uses SQLite? or SQL Server? If he learns how to write his web applications using PEAR the first time around, then all he has to learn next time is the differences in query language. If he learns how to use only MySQL specific functions in PHP, then on top of learning the differences between databases, he also has to learn an entirely new client library.

      --
      If I don't put anything here, will anyone recognize me anymore?
  65. WAMP - I'm not an expert, but it was easy... by mj · · Score: 1

    I tried this WAMP setup. PHP, MySQL and Apache all in one. It was really easy.

    In no time, I had some PHP software up and running on it.

    Don't know if it's the best or not, but it worked for me on my Windows box right away. Just install and it has a nice control-panel based thing to use. I use it for an intranet site at work.

    http://www.wampserver.com/en/index.php

    (and I didn't need a book to set it up...)

  66. Re:Why MySQL and not PostGreSQL? (honest question! by adolfojp · · Score: 1

    MySQL beats the others in speed only if you use the default table type. When you change to an ACID compliant table you loose your speed. When working with simple sites with little data and not many concurrent users I've found flat file databases like Sqlite to be faster than MySQL.

    Cheers,
    Adolfo

  67. Request for Comments by Darth_Burrito · · Score: 2, Interesting

    Lately I have been tasked with helping our communications department get on track with creation of a data driven website. At the moment, we're talking about helping two people. One is a graphic designer who manages a fairly large website. She has done a little bit of asp/access, but I don't think she understands it particularly well. She says she did a little php a long time ago. The other individual has been maintaining a filemaker database which presently contains data that is not in an optimal format for programming. This second individual has, using filemaker, managed to generate static pages off of the data (using some rather scary techniques). While they both have probably seen or written a few sql statements, I doubt they understood what they were doing.

    I am on loan to this department, so I can't just finish the project in a weekend and then hand it to them. Rather it's going to be a fairly long drawn out educational process (~2 months @ 1/2 time). They need to be able to understand how it works, how to maintain it, how to enhance it. Essentially they need to be an integral/invested part of the development process.

    Anyways, my initial idea was to have them use PHP alongside Pear's DB_DataObject and eventually Html_QuickForm libraries. For those not in the know, DB_DataObject is an object oriented data access layer generator framework thingy. Basically, instead of establishing connections, writing sql statements, and iterating over recordsets, they can write fairly simple code like the following.

    require_once('some-config-file.php');
    $student = new DB_Student(); // declaration
    $student->get(2); // gets the student with pri key=2
    print $student->name; // print's student's name.
    $student->name = "Bob Bobertson"; set students name.
    $student->update(); // commits name change

    Now when I see a newbie book teaching people to pound out their own sql and use old school mysql_connect style functions, I question my judgement. Is it a good idea or a bad idea to try to introduce these kinds of rapid development tools to novices? On one hand, these tools make my life easier on a daily basis. On the other hand, sometimes it's better to know the basics before going off to advanced topics like this. What do you guys think?

    It should be noted that whatever happens we are not sticking with filemaker (not even my decision). We will either be using Access which doesn't appear to be supported by DB_DataObject or potentially Access/ADP/MSDE or Access/Linked/MySQL which both do work with DB_DataObject. I am desperately trying to set up something that lets them create/edit/drop tables from within Access and lets them easily design queries in access which are then usable with DB_DataObject.

    Thus far, the closest I've come is using MSDE (light weight MS SQL Server) as the backend for Access. This is done using the Active Data Project (ADP) format not with linked tables. They can create/edit/drop tables and create views in Access. The views and tables are all reachable via DB_DataObject. However, there is no expression builder in the Access interface when working in this fashion.

    This is problematic because these folks are more accustomed to using wizards to dump all of their messed up logic right into their database software. I can see them wanting to create numerous complicated views but not knowing how unless they learn a sizable chunk of TSQL. If they have to do that, the value of a library like DB_DataObject, which prevents them from having to write sql, is significantly reduced.

    Personally, I think it all comes down to which they want to be easier: creating access forms/queries/etc or creating data driven web pages. Any thoughts?

    1. Re:Request for Comments by mabinogi · · Score: 2, Interesting

      > Now when I see a newbie book teaching people to pound out their own sql and use old school mysql_connect style functions, I question my judgement. Is it a good idea or a bad idea to try to introduce these kinds of rapid development tools to novices? On one hand, these tools make my life easier on a daily basis. On the other hand, sometimes it's better to know the basics before going off to advanced topics like this. What do you guys think?

      Object oriented data access layers can sometimes be useful - but sooner or later you're going to do a complex query spanning multiple tables, and you'll wish you used SQL.
      Usually the best approach is a combination, and if you design your data access layer correctly the SQL vs ORM decision doesn't have to be system wide.
      If you're using Java or .NET, then a tool like iBatis seems to be just the right balance between power, abstraction and simplicity. I don't know if something similar exists for PHP.

      Abstracting the database is ALWAYS a good thing. Books teaching the use of the mysql_* functions in PHP are simply WRONG, and should not be allowed to be sold. Those books are responsible for every slashdotted and vulnerable PHP site on the net, and contribute to the lack of good design principles.

      --
      Advanced users are users too!
    2. Re:Request for Comments by Darth_Burrito · · Score: 1

      Thank you for the response.

      but sooner or later you're going to do a complex query spanning multiple tables, and you'll wish you used SQL. Usually the best approach is a combination....

      Even though DB_DataObject has an ok query interface, I agree that eventually they are going to need to be writing some sql. It's just unavoidable, but my guess is that this will not happen very often. When the time came, if DB_DataObject couldn't handle it, my plan was to toss them up to the pear:Db level. This is a generic database interface similar to perl's dbi which is only slightly better than mysql_* functions.

      Thank you for the link to Ibatis. It looks fairly slick. I don't really think these guys could ever handle java/.net style development, but I might give it a go sometime. Again, thanks.

    3. Re:Request for Comments by mrfatmann · · Score: 1

      > On the other hand, sometimes it's better to know the basics before going off
      > to advanced topics like this. What do you guys think?
      Just my 2c. Unless they're completely lost, you can teach anyone to perform a complex task using complex methods. The more basics you know the more they'll get into trouble.

      I'm gon'na stick my neck out and butt in. I noticed in your characterization of these designers, you were none to nice in describing their grasp of it. Then they need some instruction. I'll ask you if you see wisdom in a basics approach described by the book review, plus a detailed toolbox of your methods for the site's design? Baring exceptions/deviations for performance, it this bottom up approach could level the discussions.

  68. PHP is the Visual Basic of the web. by adolfojp · · Score: 1

    Most PHP developers that I know don't take those things into consideration, and when they do, they move on to something like Java, Python and .NET

    That is one of the main reasons that made me settle for ASP.NET on the app servers and linux on the database and NSF servers. I get built in caching capabilities so I can decide to keep the State query on memory or on disk for, lets say, a day.

    Yes, I know that the same thing can be achieved with PHP and third party products, but my point is that PHP is a friendly, quick, and easy point of entry to many people. Therefore, many mistakes can be made and the outcome is not allways the best.For that reason I like to call PHP the Visual Basic of the web.

    Cheers,
    Adolfo

    1. Re:PHP is the Visual Basic of the web. by Anonymous Coward · · Score: 2, Informative

      "Many mistakes can be made" with any language. If you think that specifying a particular technology will avoid mistakes, that's fine, but you will always have people who don't know anything about programming but can verifiably claim to know a language and will proceed to develop garbage. I think all of the popular languages for building web-based apps are on the wrong track in that none of them offer data dictionaries or similar workload-reducing features except in the form of third party packages. There is Zope with the CMF, but nobody seems to know how to use it (and the people who do probably had their own frameworks built in their language of choice before they ever saw it). Yes, PHP may be the Visual Basic of the web, but like VB, it is extremely powerful in the hands of a good programmer.

      We keep trying to solve problems with different languages when the real problem is with the programmers; they need training, they need to enjoy what they are doing, and they need to be encouraged to be good programmers, not coders in a specific language.

    2. Re:PHP is the Visual Basic of the web. by adolfojp · · Score: 1

      Thats exactly my point. :-)

      Cheers,
      Adolfo

  69. Re:Why MySQL and not PostGreSQL? (honest question! by drew · · Score: 1

    i used mysql at work for some time from 1998-2001. at one job we had about 12-16 mysql servers, and every week, at least one of them would hang until we truncated that data files and restarted the server process. not really a big deal to us, as we used the mysql servers for pure speed- all of the data in the mysql databases was tracking data that was aggreagated into two oracle databases on sun e5000's. (the mysql db's were also on suns, but smaller)

    i worked at another job where we were using mysql to back an in house cms system, and the data corruption there was less frequent but more problematic. all of the data that went through the system was also archived in rcs, so we never lost any data, but it was still a pain restoring it.

    i haven't used mysql since then, so i don't know what it is like currently, but the attitude of the mysql developers was never very reassuring to me either.(*) it's been a long time since i've worked on a project where database speed was my primary concern, so when i can choose my database, i usually choose postgresql. when i can't, it usually seems to be oracle or ms sql server. if i had to work on another project like i did in '99 where speed was my primary concern, i would take another look at mysql- that was why that company used it after all. for all the problems they had with it, nothing else was nearly fast enough.

    (*) given the rather famous rant about why foreign keys are a bad thing and you should never use them, as well as some of the other statements they've made over the years about transactions, atomicity, etc. i have a hard time trusting my data to an application written by somebody with their attitude. that is the main reason i say that while i am sure that the mysql of today is nothing like the mysql i used years ago, i still have no intention of trying it again.

    --
    If I don't put anything here, will anyone recognize me anymore?
  70. Re:Why MySQL and not PostGreSQL? (honest question! by Just+Some+Guy · · Score: 1
    As it turns out, mysql was still an order of magnitude faster on some tests, while mysql and postgres were close on only a few of the tests.

    There's also such a thing as programming idioms. Translating a set of non-ACID MySQL queries verbatim to PostgreSQL isn't likely to give good performance, in much the same way that writing C in Python is going to be dog slow. It doesn't seem to like getting bogged down in the hundreds of tiny individual queries that people used to fire off to MySQL back when they used to think that MyISAM was pretty cool.

    On the other hand, idiomatic PostgreSQL is likely to be nearly as fast (or much faster) than its MySQL counterpart, much as idiomatic Python is comparable to C. In both cases, given the backend a high-level task and letting it handle the low-level optimization usually results in a huge performance boost.

    In other words, you can't take a series of queries written for 3.x-era MySQL and expect them to run well on pretty much any other database. If that's not what you're doing, then I apologize. If it was, then you might consider re-thinking your testing methodology before drawing conclusions.

    --
    Dewey, what part of this looks like authorities should be involved?
  71. Nice book by Pan+T.+Hose · · Score: 2, Interesting

    First of all, this book seems like a nice rewrite of on-line documentation. It is even a good idea in principle, because building a database driven site with PHP and MySQL is indeed very quick, almost as quick as using Perl and SQLite, but as with every RDBMS there are gotchas. It is true for MySQL, true for PostgreSQL, true for SQLite and even for Oracle, because just like no system is secure, no database is perfect. You always have to know the gotchas to work around them, which is especially important when you want to write a portable database-independent application, which is always a good idea. Unfortunately, this book lacks many important informations about those issues, as it also lacks essential introduction to relational algebra, set theory and predicate calculus, which are important to understand the relational model and to know what the relational database is all about. Without such background, people tend to confuse the relational model with a SQL interface to the filesystem, or an object store, so the lack of such an introduction is the most important flaw of that book. Other than that, it is quite a nice rewrite of many HOWTOs available on-line, and it is always easier and quicker to read one book than to hunt countless websites. All in all, a nice book.

    --
    Sincerely,
    Pan Tarhei Hosé, PhD.
    "Homo sum et cogito ergo odi profanum vulgus et libido."
  72. I guess it might be worth mentioning ... by macaulay805 · · Score: 2, Interesting

    I guess it might be worth mentioning that when I built my first MySQL/PHP site, I used ADOdb. ADOdb is pretty slick! This is comming from a person who:

    1. Never programed in PHP! (Hell, never programed in ANYTHING before)
    2. Never did ANYTHING database related before!

    An all-general newbie to this kind of stuff. In one day, I learned how to create tables, insert data, display data on web pages, and all of the other basic stuff! At least a must-check-out for beginers! Ohh yeah, and "use the force, read the source" .. examples can really clarify things as well!

    PS - Must Explain why I still have a girlfriend!

    1. Re:I guess it might be worth mentioning ... by Anonymous Coward · · Score: 0

      Sure, but what about us left behind having to maintain/babysit piece of crap setups (non-transactional, non-error handling, non-relational) built by people who

      >1. Never programed in PHP
      >2. Never did ANYTHING database related before!

  73. Dynamic website == slow and CPU heavy by jgarzik · · Score: 4, Insightful
    Unfortunately, the book review sounds like the book is missing information on one of my pet peeves:

    Fully dynamic websites will crush your server.

    Dynamic websites may be easy for beginners with this book, but introduce (a) a large amount of data or (b) a large amount of traffic (e.g. slashdot effect), and your server will fall over faster than a debutante in her first set of heels.

    I was on the team that helped set up cnn.com, back in the "early days" of the Web. And more recently, during the U.S. presidential debates, I convinced FactCheck.org that their server would stop falling over, if they just exported their article database as static HTML files, rather than being 100% dynamic. (that indeed fixed the problem)

    Dynamic content has its place, but too many newbies make the assumption that a fully dynamic website is a good idea. For content that does not change frequently, it is often more wise to use triggers to export the data as static HTML than to continually query and generate the same dynamic content over and over again. Database query caches help, but not a whole lot. Static HTML pages, and dynamic pages that provide the HTTP cache/expire/etag info are much more friendly to the web caching infrastructure in your browser and at your ISP.

    1. Re:Dynamic website == slow and CPU heavy by Anonymous Coward · · Score: 0

      There is another method. PEAR:Cache. This will let you specify how long and under what conditions a dynamic page will be delivered from a temporary cache file.

      Another Sitepoint author, Harry Fueks, wrote a much better book(s). "PHP Anthology....something something.." His books can be used to build a quick site for a newb. But he immediately covers OOD and security.

      For example, on form processing, he has the student write and reuse a escape quotes class in all subsequent code. He adhers to using interfaces for databases for scaleability. All in all these two books were very good.

    2. Re:Dynamic website == slow and CPU heavy by nbritton · · Score: 0

      Like other have pointed out an optcode cache is essential for php websites. eAccelerator, previously known as MMCache, is one of them and it's OSS. http://eaccelerator.net/

    3. Re:Dynamic website == slow and CPU heavy by ErikZ · · Score: 1

      When my web site has the traffic of CNN, I'll take your advice to heart. But my site is medium sized and is doing great. In fact, I'm in the middle of adding more dynamic content.

      Dynamic content rocks and isn't a problem for the vast majority of the people who use it.

      --
      Democrats or Republicans. They are both taking us to the same place and they are not afraid of us anymore.
  74. My PHP Slides by Sim9 · · Score: 2, Informative

    If anyone is interested in some extra resources for learning PHP, check out my powerpoint slides:

    http://www.cs.trinity.edu/~rzinchak/php/

    1. Re:My PHP Slides by Nostrada · · Score: 1

      Thanks, this is very nice, don't let anyone trash talk it. Much appreciated!

      --
      Cheers, Nostrada
  75. WRONG by Anonymous Coward · · Score: 0

    You have one friend in app design: Mr. Benchmark.

    If connection pools make your app go faster, use em. If they don't, then leave them out and keep your app simple.

    If your site is fast enough, don't do anything. Keep your app simple.

    If your app is slow, find what makes it slow and correct it. Otherwise keep your app simple.

    What do I mean by simple? I mean, use one class instead of a hierarchy of three if there's no need for the abstraction. Don't say "I might need it someday". Not using classes? No problem, you might not need them. When you do, you can add them. Don't use temporary variables to save compution. Don't pile everything into a small number of functions to avoid "function calling overhead". Don't indent more than 2-3 levels.

    Concentrate on simple, readable, understandable, well-factored code. Then when it comes time to optimize (after you get a good set of benchmarks in hand of course), you will have a much easier time of it.

    Advice from the trenches..........

  76. Re:Why MySQL and not PostGreSQL? (honest question! by Anonymous Coward · · Score: 0

    > Two words: blazing fast.

    Assuming you're using myISAM. No transactions, and a 2G limit. InnoDB and BDB are a great deal slower.

    Yeah, ISAM is fast. They figured that out in the 60's

  77. Um, when is the last time you set it up? by Anonymous Coward · · Score: 0

    Its as simple as ./configure && make && make install, then you can tweak the config file if you want, or just init the database and start it up. Its been this easy for at least 4 years, which is when I started using it.

  78. Corrections. by Anonymous Coward · · Score: 0

    For select intensive applications that don't use transactional table types its slightly faster. And postgresql lets you run an autovaccuum to do it in the background whenever it needs, or you can still schedule it manually if you have an off-hours time you want to do it in.

  79. more details on benchmark by Anonymous Coward · · Score: 0

    Assuming that performed the benchmark for your own dataset, which interface did you use ? How about native SQL statements.

  80. Forget this book by Earlybird · · Score: 1
    ...and read ONLamp.com: Rolling with Ruby on Rails instead, as previously covered on Slashdot.

    • Maybe you've heard about Ruby on Rails, the super productive new way to develop web applications, and you'd like to give it a try, but you don't know anything about Ruby or Rails. This article steps through the development of a web application using Rails. It won't teach you how to program in Ruby, but if you already know another object-oriented programming language, you should have no problem following along (and at the end you can find links on learning Ruby).

    As a result, you will become a happier, more spiritually enlightened person. No, really!

  81. Informative how? by Anonymous Coward · · Score: 0

    If you can't manage to find hosting with postgresql support, you are blind or retarded. I found far more than I needed to when I looked, and ended up making my hosting choice based on other factors since postgresql was so widely supported.

  82. MySQL webspace is cheaper by walterbyrd · · Score: 1

    Maybe that only begs the question: why is mysql webspace cheaper?

    I don't know why, but if you are looking for way cheap webspace. Like free to $5/month. You'll probably find more offer mysql than postgre.

    Seems to be my experience anyway.

    1. Re:MySQL webspace is cheaper by jadavis · · Score: 1

      I think that has to do with the number of users also.

      If someone asks for PostgreSQL by name, they just don't care about a few bucks a month, and they are interested in higher-quality hosting.

      If PostgreSQL were ubiquitous, I'm sure the hosting would be just as cheap.

      --
      Social scientists are inspired by theories; scientists are humbled by facts.
    2. Re:MySQL webspace is cheaper by Anonymous Coward · · Score: 0

      Maybe that only begs the question: why is mysql webspace cheaper? I don't know why, but if you are looking for way cheap webspace. Like free to $5/month. You'll probably find more offer mysql than postgre.

      Ever tried Google? When I did this search, I even got this sponsored link: $4/mo PostgreSQL Hosting.

  83. Properly cached dynamic == fast and light by Jamie+Lokier · · Score: 1

    I have to wonder why anyone wouldn't be using cached dynamic pages...

    If your pages are cached with sensible conditions: that is, they depend on the content used to generate them, then you get marginally better performance than triggers which regenerate static HTML - and no briefly out of date pages.

    If you're using a database to back the site's content, then you'll need simple triggers to flag those conditions. Otherwise, if you're using files to back it (e.g. a file per article), you don't even need that and you get up to date dynamic pages from templates with the performance of a fast optimised static server.

    -- Jamie (who is building a server which works exactly like the latter...)

  84. Mambo Content Management System? by addbo · · Score: 1

    I've found that Mambo is a quick way to put up a very nice and robust database driven site that also uses PHP... Do we really need to reinvent the wheel?

  85. Re:Why MySQL and not PostGreSQL? (honest question! by jadavis · · Score: 1

    When reporting benchmarks, you should report in excruciating detail. If it's too long for a post, give us a link to a website about the benchmark.

    PostgreSQL and MySQL are designed to perform in different environments. There are fundamental design choices that determine the areas that each will excel. The most major one is PostgreSQL's MVCC vs. MySQL's locking. Each strategy is used to maintain ACID compliance (I'm talking about InnoDB now, since that has a more comparable feature set), but the performance implications are profound. In particular, PostgreSQL avoids many performance issues with locking. However, for a web app, maybe you don't care so much about locking. It all depends.

    Each benchmark only matters to the specific set of database operations your applications are performing. Being more clear about the benchmarks enables the readers to either:
    (a) relate to your results because their applications perform similar operations; or
    (b) decide that a bunch of "select 1" queries from a single app aren't really representative of their usage patterns.

    I am not saying that you ran a bunch of "select 1" queries. But without the tuning parameters of the benchmark software and the detailed sequence of events, your comment is no more useful.

    --
    Social scientists are inspired by theories; scientists are humbled by facts.
  86. Re:Why MySQL and not PostGreSQL? (honest question! by jadavis · · Score: 1

    I have a similar attitude toward the developers of MySQL.

    However, you should realize that with either, the probability of hardware failure is much greater than software failure (you might have a different story if you buy good hardware).

    What worries me more than crashes of MySQL is the fear that it will do something I don't expect. Perhaps MySQL makes a lot of sense to some people, but PostgreSQL fits my brain much better.

    --
    Social scientists are inspired by theories; scientists are humbled by facts.
  87. Here is an even faster way to build your own site: by Lodragandraoidh · · Score: 1

    Zope plus Plone - if you are looking for a content management system, or Zwiki if you are looking for a wiki solution, or learn Python and roll your own inside of Zope's Management Interface (ZMI).

    Before you know it you will have dynamic content coming out of your ears - and you won't have to muck about with a relational database at all (and the ZODB scales better anyway from my experience).

    --

    Lodragan Draoidh
    The more you explain it, the more I don't understand it. - Mark Twain
  88. Re:Why MySQL and not PostGreSQL? (honest question! by dema · · Score: 1

    What worries me more than crashes of MySQL is the fear that it will do something I don't expect.

    That's another thing I seem to see on occasion with little elboration. What exactly do you mean by "something you don't expect?" And why do you think it is more likely to do that than any other database?

    It would seem that personal experience is the most common reasoning behind people's dislike of MySQL. But it also appears that a lot of people's experiences come from a while back (e.g. grandparent), and have prompted them to not try it again as it has developed.

  89. Re:Why MySQL and not PostGreSQL? (honest question! by drew · · Score: 1

    a lot of people's experiences come from a while back (e.g. grandparent), and have prompted them to not try it again as it has developed.

    well, as i said in my last post, my past experiences with mysql are only a small part of the reason that i don't use mysql today. the biggest reason i don't currently use mysql is that postgresql provides more features that i use, and it's been a long time since i worked on a project where database speed was the primary concern. if i were to work on such a project again, i would be happy to look at mysql again, but lacking that there's not really any compelling reason to consider mysql again and give up stored procedures, true sequences, etc.

    the other primary reason that i don't use mysql, which i mentioned, and which i think the poster you responded to meant by 'doing something he doesn't expect' is that the mysql developers have said and done a lot of things over the years which cause me and many others to wonder how much they really know about good database principles. and i would hesitate to trust a database written by people to don't really seem to understand the concepts behind data integrity.

    and that's why you see comments like this on a regular basis. it's often based on the impressions that have been made by the developers rather than any specific behavior of mysql itself.

    but anyway, an example of mysql doing something you wouldn't expect:

    the lest time i used mysql, when you would insert into a column whose primary key is an auto-increment integer, the insert returns the next integer in sequence, whether the insert succeeded or failed. so rather than checking the return value of the insert to see if the query succeeded (and using the value in your application if it did) you have to do a select with that value to see whether there is actually a row present with that id. that is an example of mysql doing something that you wouldn't expect. and that behavior existed for at least two years before it was changed (if it ever was- i have no idea how long that behavior existed before i started using mysql, and whether it was ever fixed after i stopped)

    --
    If I don't put anything here, will anyone recognize me anymore?
  90. Pass this one up by Anonymous Coward · · Score: 0

    I bought a previous edition of this book based on a "cautiously positive" review on Slashdot, and returned it - save yourself the trouble and don't bother. I don't know about this edition but based on the previous it's all fluff and no substance. Written like a student solely for the sake of ego. Not a single complete example in the whole book, and the main "pull-it-together" example required the user to type data in manually (rather than pull from database)! Too sparse for experts, and too irrelevant for beginners. Thumbs-down.

  91. Why not just use text files? by 5n3ak3rp1mp · · Score: 1

    ooooohhhh man.

    Come back here in a few months, after a few hundred (or maybe a few dozen) more postings to your site. Bogged down yet?

    After all, I bet Slashdot would have been fine using just TEXT FILES... at least in the first few weeks or so.

    Indexes are why databases exist. And indexes take a huge heap of data, and prevent you from having to examine every little blade of hay every time you're looking for a needle.

  92. Re:Why MySQL and not PostGreSQL? (honest question! by sloanster · · Score: 1

    When reporting benchmarks, you should report in excruciating detail

    meh. not intended to be a report, just a data point. But I did run a number of sql benchmarks, including the wisconsin benchmark. On the wisconsin benchmark, for instance, postgresql took about 5 times as long as mysql to finish.

    It's not really practical for me to answer every heckler, but to the guy who mentioned a 2 GB file size limit, oracle had that limitation for years, but somehow managed to handle bigger size databases than 2 GB. ask yourself how oracle did it. apply the answer to mysql.

    In short, I would love to see a benchmark that would show postgresql in a positve light! If any of you postgres fans knows of such a benchmark, bring it on, I'd love to run it on both pg and mysql to see for myself.

  93. Re:Why MySQL and not PostGreSQL? (honest question! by jadavis · · Score: 1

    Well, I've been bitten by a few date handling issues in the past.

    Perhaps some are corrected. Is Feb. 31st still a valid date in MySQL? It seems to me that in order to maintain backwards compatibility, MySQL would have to continue to do some of the strage things it did before. And "strange" is certainly in the eye of the beholder, but some things just really didn't fit my brain well at all.

    --
    Social scientists are inspired by theories; scientists are humbled by facts.
  94. Offtopic answer to Apache question by Anonymous Coward · · Score: 0

    You posted a question about how to force Apache into running seperate named sites, but it's been archived so I can't answer it. Hopefully you'll see it here. (This reply posted anon 'cause it's OT) http://apache.slashdot.org/comments.pl?sid=133526& cid=11183303

    If you really want to run separate different with essentially jailed configurations of Apache, you need to run different seperate instances of Apache. Improvements in Apache may reduce your desire to do this, but they'll never make it not true for some fringe cases.

    However, I think I can give you a suggestion that provides a possible solution your question. 1) Run site 1 Apache on port 8001. Run site 2 Apache on 8002. Run different instances listening on those ports.

    Run a main instance of Apache on port 80. Use mod_proxy and the ProxyPass directive inside each virtual host. So www.host1.com is proxied to 127.0.0.1:8001/ etc. This gives you named resolution to arbitrary ports OR hosts, so this result scales to multiple servers on multiple OSes - you can have www.mainhost.com on linux and www.winhost.com on a Windows box, both on the same routeable IP, using named differentiation on a gateway apache server (which can be either of them)

    You can also use this technique to have www.host.com/win/ be a different machine.

    The only problem is certain forms of server side tracking don't work properly because at least by default the requesting IP is the proxy (it's not a transparent proxy by default, at least)

    - Arete
    areteslashdot AT xig net

    1. Re:Offtopic answer to Apache question by jadavis · · Score: 1

      Thanks, that's interesting. I'll have to try out that ProxyPass thing.

      --
      Social scientists are inspired by theories; scientists are humbled by facts.