Appendix H. The Improved MySQL Library

A new improved MySQL function library is being developed for applications that use PHP5 and MySQL 4.1. It gives you access to new features that are available in MySQL 4.1, including preparing and executing queries, load balancing, and encrypted and compressed connections. These features, along with others that are discussed in this appendix, allow you to improve the performance of your web database application.

At the time of writing, the library is experimental, meaning that names of functions and parameters may change. However, it’s likely that the library will remain in roughly its current form and that it’ll soon be a stable component of PHP. It won’t replace the regular library; it will be an additional tool that’s available for you to use.

If you’re using MySQL 4.1, you need to know about this new improved library. At the time of writing, you can’t use the MySQL library that’s discussed in Chapter 6 or the PEAR DB package described in Chapter 7 with MySQL 4.1. However, it’s likely that in the future, both the standard library and PEAR DB may work with MySQL 4.1; there’ll be pressure on the PHP developers to offer backward compatibility for legacy code.

In this appendix, we briefly introduce some of the new concepts in the improved MySQL library and show you simple code examples. For more detailed information and function prototypes, refer to the PHP manual at This appendix assumes you’ve read ...

Get Web Database Applications with PHP and MySQL, 2nd Edition now with the O’Reilly learning platform.

O’Reilly members experience live online training, plus books, videos, and digital content from nearly 200 publishers.