If you want to use ext/mysqli, the switch for with-mysql has to point to /path/to/mysql_config. Windows users have to use the files php_mysqli.dll and libmysqli.dll, the rest of the previous install instructions remain unchanged. Connecting to MySQLi (mysqli_connect.php)<?php if ($db = @mysqli_connect('localhost', 'user', 'password')) { mysqli_select_db($db, 'phrasebook'); echo 'Connected to the database.'; mysqli_close($db); } else { echo 'Connection failed.'; } ?> Connecting to MySQL using ext/mysqli works just like using ext/mysql, however an i is appended to the function names. Keep in mind that the different variable order for mysql(i)_select_db()is one of the prominent differences between the two extensions. The newer one wants the database handle first. Another difference between these two extensions is that the database handle is a mandatory parameter whenever used. With ext/mysql, the last handle created by mysql_connect() is the current default handle for the page. One more difference: mysqli_connect() accepts the name of the database as an optional fourth parameter, so you can avoid using mysqli_select_db().
|