PHP currently offers multiple ways of working with MySQL. Some of the more popular methods include:
This package offers a database-independent API for communicating with relational databases from PHP. PEAR::DB includes support for MySQL, but provides only rudimentary support for MySQL stored programs.
This PHP extension provides MySQL-specific support for
working with MySQL. However, the
mysql extension does not include
methods for working with advanced MySQL features introduced in
MySQL 4.1 and 5.0 and will probably never provide direct support
for stored programs.
This PHP extension was introduced to support new features in MySQL 4.1 and 5.0.
PDO is a database-independent interface that will probably become the successor to the PEAR::DB interface. PDO became an officially supported interface only in PHP 5.1, so it is the newest of the PHP database interfaces.
mysqli and PDO
extensions provide full support for MySQL stored programs. In this
chapter we will show how each can be used to interface with MySQL and
how to use MySQL stored programs.