It is probably outdated book and the page no longer exists?
You can use this;
http://dev.mysql.com/downloads/connector/php-mysqlnd/
If you want to connect to your MySQL database with PHP all you need is a connection script. There are lots of simple ways to connect to a MySQL database;
PHP Code:
<?php
mysql_connect("localhost", "username", "password") or die(mysql_error());
echo "Connected to MySQL<br />";
?>
will return an erro if not connected, and display
Connected to MySQL if it is successful.
But the idea of the connection is to get and display the content of a database, so this is commonly written.
PHP Code:
<?
// hostname or ip of server, more than likely localhost
$servername='localhost';
// username and password to log onto db server, enter your values
$dbusername='username';
$dbpassword='password';
// name of database on the MySQL server
$dbname='db_name';
////////////// Do not edit below/////////
connecttodb($servername,$dbname,$dbusername,$dbpassword);
function connecttodb($servername,$dbname,$dbuser,$dbpassword)
{
global $link;
$link=mysql_connect ("$servername","$dbuser","$dbpassword");
if(!$link){die("Could not connect to MySQL");}
mysql_select_db("$dbname",$link) or die ("could not open db".mysql_error());
}
?>
Then obviously, you want to print a value stored in the database, use this type;
PHP Code:
<?php
// define database to connect to
$database="yourdbname";
//define connection variables
mysql_connect ("localhost", "yourusername", "yourpassword");
//return error if wrong database or doent exist
@mysql_select_db($database) or die( "Unable to select database");
//get results of table
$result = mysql_query( "SELECT field1, field2, field3 FROM yourtable" )
// return error if tables are wrong or dont exist
or die("SELECT Error: ".mysql_error());
// define rows
$num_rows = mysql_num_rows($result);
// print heading and table to show results
print "There are $num_rows records.<P>";
print "<table width=200 border=1>\n";
while ($get_info = mysql_fetch_row($result)){
print "<tr>\n";
foreach ($get_info as $field)
print "\t<td><font face=arial size=1/>$field</font></td>\n";
print "</tr>\n";
}
print "</table>\n";
?>
YOu will obviously need to change some of the commented variables in each sample to your own user name and passwords, tables and databases.
Hope these samples help.