Hour 13. Database Integration—SQL
What You'll Learn in This Hour:
A few SQL samples
How to connect to a MySQL database server
How to select, insert, and update data with the MySQL functions
How to select, insert, and update data with the SQLite functions
How to work with the PEAR::DB package
One of the defining features of PHP is the ease with which you can connect to and manipulate databases. In this chapter we will look at three database packages that lie at the heart of PHP. MySQL has traditionally been the database of choice for PHP developers. A vast number of scripts have been developed using the so-called triad of PHP, Apache, and MySQL. We will also examine SQLite, which is new with PHP 5. The fact that it is bundled with the PHP distribution and works efficiently with flat files, requiring no separate server, is likely to make it a favorite for developers who require a lightweight solution. Finally, we will examine the PEAR::DB package, which stands above database-specific functions, providing a unified interface that enables the programmer to write a project once and then run it seamlessly with different database applications.