Databases

There are always many options when working with databases, so many different ways to connect and work with them, for most languages and PHP is no different. However it seems to me that PHP Data Objects or PDO is the standard, so this is what I am going to use. See PHP: PDO - Manual for the documentation.

PDO has drivers for many different databases, the key ones for me are MySQL, Oracle, SQL Server, SQLite3 and Firebird. Most web based PHP solutions use MySQL, so I won't be any different.

When you look closely there are several ways to connect PHP to MySQL, see PHP: Choosing an API - Manual for more information. However again, PDO looks favourable, especially as it is an abstraction and will work better should you choose to support other databases or want to switch. It is also worth noting that PHP: Mysqlnd - Manual is the library the PDO uses to access MySQL, this is preferable to the native compiled library.

In trying to get PDO working on my Windows machine I needed to add the php_pdo_mysql extension, see PHP Extensions for more information on this.