Hi all. I've recently set up Apache 2.2 with PHP 5.2 and MySQL 5.1. I played around with SQL a bit, and now I'm trying to access it with PHP. I currently have the code:
When I run the above in Firefox with my correct password, all I get is "test", verifying to myself that PHP was working when the script ran. I've also verified that the username and password correctly start MySQL though the CLI, but I don't think that's the issue here. If they were incorrect, I should get the "Could not connect" message and the MySQL error, but I get no errors at all. This makes me think the mysql_connect function itself isn't working right.
What possible mistakes could I be making? Thanks in advance.
Code:
<?php
# error_reporting(E_ALL);
# ini_set('display_errors', true);
echo "test";
$link = mysql_connect('localhost', 'root', '[mypassword]');
if (!$link) {
die('Could not connect: ' . mysql_error());
}
echo 'Connected successfully';
?>
What possible mistakes could I be making? Thanks in advance.
Comment