I am trying to connect to mysql from php Below is the sample code i used.
$username = "root";
$password = "pwd";
$hostname = "localhost";
$dbh = mysql_connect($hostname, $username, $password) or die("Unable to connect to MySQL");
print "Connected to MySQL<br>";
The problem here is I am not getting any error message. The page does not display anything. But when i comment the mysql_coonect() line i can see the prints and echo's. I tried checking if $dbh is valid and also tried putting the code in an exception block. But nothing helps. I have tried many variations of the above code to no effect.
Please help me to identify the problem.
I am able to execute php scripts which shows that my php install is fine.
I am also able to login to mysql db using (locaalhost, root,pwd) in command prompt and using mysql workbench.
Php version = php-5.2.13-win32-
MySql version = mysql-essential-5.1.48-win32