Please help if you can - stumped!
Got to the stage (p.117) of connecting to MySQL with PHP.
Accessing the php file on localhost which contains:
<?php
$link = mysqli_connect('localhost', 'root', 'password');
if (!$link)
{
$output = 'Unable to connect to the database server.';
include 'output.html.php';
exit();
}
if (!mysqli_set_charset($link, 'utf8'))
{
$output = 'Unable to set database connection encoding.';
include 'output.html.php';
exit();
}
if (!mysqli_select_db($link, 'ijdb'))
{
$output = 'Unable to locate the joke database.';
include 'output.html.php';
exit();
}
$output = 'Database connection established.';
include 'output.html.php';
?>
i.e. http://localhost/connect/index.php or http://localhost/connect
produces a 500 server error.
This seems odd, as I have successfuly accessed and run other php filesin previous exercises in the book. The only difference with this one is that it references mysqli.
I can successfully connect to mysql via the command prompt, so that appears to working.
Thanks!