I am trying to so a simple CRUD tutorial from this page.
[URL=”http://www.codeofaninja.com/2012/01/phpmysqli-connect-to-database.html”]http://www.codeofaninja.com/2012/01/phpmysqli-connect-to-database.html
I created in PHPMyAdmin the database and table structure but i get a database not found error.
Since the default “localhost” parameter did not connect, I changed that parameter to “localhost:8080”. Now when I hit load the page just hangs and eventually times out. I am assuming that is the wrong $host?
My URL in Firefox for WAMP is [url]http://localhost:8080/NINJA/
[CODE]<?php
//set connection variables
$host = “localhost:8080”;
$username = “root”;
$password = “”;
$db_name = “codeofaninja”; //database name
//connect to mysql server
$mysqli = new mysqli($host, $username, $password, $db_name);
//check if any connection error was encountered
if(mysqli_connect_errno()) {
echo “Error: Could not connect to database.”;
exit;
}
?>