I know this horse has already been beat to death on this forum, but I have spent more hours than I care to admit attempting to get this problem solved, to no avail. I am new to MySQL (zero experience) and am studying the book Build your Own Database Driven Website Using PHP & MySQL 4th edition by Sitepoint. I have experience using PHP. Chapters 1 through 3 went fine with no problems. From the mysql command prompt I have created a database, created a table and then added data to the table just as the book describes. The PHP files in chapters 1 through 3 also functioned properly. When I attempted to connect to the database using PHP in chapter 4 is where I am experiencing problems. When the mysqli_connect command is executed, I receive the error
Fatal error: Call to undefined function mysqli_connect() in D:\wwwtop\MySQL_class\connect\index.php on line 4.
Here is the code (mostly copied from the book):
<?php
echo 'Marker 1';
$link = mysqli_connect('localhost', 'root', 'mypassword');
echo 'Marker 2';
if (!$link)
{
$output = 'Unable to connect to the database server.';
include 'output.html.php';
exit();
}
?>
MySQL version: 5.0.22-community-nt
PHP Version: 5.1.4
Apache Version: 2.0.58 (Win32)
Operating Sys: WIN 7 Pro - 64 bit (Intel Core i7-920 processor(8MB L3 Cache, 2.66GHz) 12 gig RAM)
Some of the things I have verified from looking at other posts:
>> To prove I am editing the correct php.ini file I have made changes (such as error reporting level) and verified the change was effective.
>> In php.ini the line extension=php_mysqli.dll exists and is not commented out.
>> My path =
%SystemRoot%\\system32;%SystemRoot%;%SystemRoot%\\System32\\Wbem;%SYSTEMROOT%\\System32\\WindowsPowerShell\\v1.0\\;c:\\Program Files (x86)\\Common Files\\Roxio Shared\\10.0\\DLLShared\\;c:\\Program Files (x86)\\Common Files\\Roxio Shared\\DLLShared\\;C:\\Program Files (x86)\\MySQL\\MySQL Server 5.0\\bin;C:\\php\\;C:\\Program Files (x86)\\Common Files\\Adobe\\AGL;C:\\php\\ext
>> I have executed the same script using my account with my hosting provider and it functioned properly.
I have been running Apache and PHP for several months with no problems. This is the first time I have attempted to use MySQL.
I originally posted in the MsSQL forum, but was advised I may get better info in this forum.
Any ideas where to look? I am at my wits’ end.
Thanks,
Steve