PHP Functions That Communicate with MySQL - dummies

By Steve Suehring, Janet Valade

PHP provides two sets of functions for communicating with MySQL — the mysql functions and the mysqli (MySQL Improved) functions. Which functions you use depends on the version of MySQL and PHP you’re using.

The mysqli functions were added in PHP 5 for use with MySQL versions 4.1 and later. If you’re using a web hosting company, you need to know whether it offers PHP 5, which version of MySQL it provides, and whether it makes the mysqli functions available.

You’re probably using PHP 5 or later, MySQL 5.0, and the mysqli functions. If your web host doesn’t offer the mysqli functions, you need to convert the mysqli functions to mysql functions.

If you installed PHP and MySQL yourself on your own computer planning to develop your PHP scripts locally and upload the finished scripts to your web hosting company, you need to install the same versions and activate the same MySQL support functions that your web host provides.

Otherwise, if you install different versions, even newer ones, the scripts may not behave in the same way on your web host’s computer as they do on your local computer.