Page 378 - Beginning PHP 5.3
P. 378

Part III: Using PHP in Practice
                  Relational Databases
                   Relational databases offer more power and flexibility than simple databases, and for this reason they
                 tend to be a more popular choice. They are also known as RDBMSs (Relational Database Management
                 Systems). You ’ ll be concentrating on RDBMSs over the next three chapters.

                   RDBMSs are often expensive and complex to set up and administer. The widely acknowledged big three
                 in this field are Oracle, DB2 (from IBM), and SQL Server (from Microsoft). All three are massive, feature -
                   rich systems, seemingly capable of just about any kind of data storage and processing that a modern
                 business could need. The flip side of the coin is that these systems are big and expensive, and may
                 contain more functionality than you will ever require.

                   Fortunately, alternatives are available, such as PostgreSQL and MySQL, which are both open source
                 relational database systems that have proven very popular with PHP developers for many years. They ’ re
                 fast, stable, easily meet the needs of most small - to - medium sized projects, and, to top it all off, they ’ re
                 free!


                  Choosing a Database
                   In principle, you can use any of these database systems in your PHP applications. You can even hook
                 one application up to several different database engines. To keep these chapters to a reasonable length,
                 however, you ’ ll focus on just one database engine: MySQL.

                   Compared to the other choices, it offers several advantages:
                   ❑       It ’ s one of the most popular databases being used on the Web today

                   ❑       It ’ s freely available as a download to install and run on your own machine
                   ❑       It ’ s easy to install on a wide range of operating systems (including UNIX, Windows, and Mac
                       OS X)
                   ❑       It ’ s available as a relatively cheap feature in many Web hosting packages
                   ❑       It ’ s simple to use and includes some handy administration tools
                   ❑       It ’ s a fast, powerful system that copes well with large, complex databases, and should stand you
                       in good stead when it comes to larger projects

                   If you ’ re not too concerned about the last criterion (and particularly if you don ’ t want to pay extra for
                 database functionality on your Web hosting account!) you might well find that an embedded database
                 such as SQLite does a perfectly good job. PostgreSQL is also a great choice, and is similar in performance
                 and features to MySQL.
                   Although these three chapters focus on MySQL, many of the techniques you learn can easily be
                 transferred to other database systems.

                      You can find out more about using SQLite, PostgreSQL, and others in Appendix C.







              340





                                                                                                      9/21/09   9:11:07 AM
          c12.indd   340                                                                              9/21/09   9:11:07 AM
          c12.indd   340
   373   374   375   376   377   378   379   380   381   382   383