Search the Community
Showing results for tags 'mysqli mysql connect'.
-
I installed mysql server 5.1 and no error happens during the installation so I assume everything is fine but when I'm learning and trying to use php and to connect through mysql and there is this error message saying Fatal error: Call to undefined function mysqli_connect() in C:\Program Files (x86)\Apache Software Foundation\Apache2.2\htdocs\books.php on line 3 My codes are here <?php $db = mysqli_connect("localhost", "root", "3308") or die(mysqli_connect_error()); mysqli_select_db($db, "booksdb") or die(mysqli_error($db)); mysqli_query($db, "CREATE TABLE books( id INT PRIMARY KEY NOT NULL AUTO_INCREMENT, title VARCHAR(64) NOT NULL)") or die(mysqli_error($db)); mysqli_query($db, "INSERT INTO books(id, title) VALUES(NULL, 'the nose')") or die(mysqli_error()); mysqli_query($db, "INSERT INTO books(id, title) VALUES(NULL, 'the overcoat')") or die(mysqli_error()); mysqli_query($db, "INSERT INTO books(id, title) VALUES(NULL, 'war and peace')") or die(mysqli_error()); $result = mysqli_query($db, "SELECT id, title FROM books") or die(mysqli_error()); while($record = mysqli_fetch_assoc($result)){ echo $record['id']; echo " "; echo $record['title']; echo "<hr/>"; } ?> in my php.ini file I did uncomment both extension=php_mysql.dll extension=php_mysqli.dll and of course restarted apache. Also restarted the who machine too but that error message keeps on coming up and I have no idea how to fix it. I searched a few forums and they all asked to make sure the extension is uncommented which they are.