can't connect to mysql database and die message not showing.
Posted: Wed Oct 04, 2006 4:25 am
hello all.
i'm a newbie to php, but a relatively experienced coder, so feel free to be technical.
i've installed apache, php and mysql.
my php script (embedded in html) is as follows:
now the strange thing is that in my html output, i get "before" printed out, but then nothing. there is more html code below the php block that doesn't get print out either (tables and lines etc). so its literally halting at the mysql_connect line.
but nothing gets printed out from the die message, so i have no clue how to troubleshoot it.
phpinfo(); returns the php settings so i know ive configured php fine.
also i followed a mysql installation tutorial step by step and have created tables and populated them, so thats working fine.
any ideas?
thanks.
i'm a newbie to php, but a relatively experienced coder, so feel free to be technical.
i've installed apache, php and mysql.
my php script (embedded in html) is as follows:
Code: Select all
<?php
echo "before";
$connection = mysql_connect("localhost", "root", "mypassword") or die("Failed to connect to database: " . mysql_error());
echo "Connected to database.";
?>but nothing gets printed out from the die message, so i have no clue how to troubleshoot it.
phpinfo(); returns the php settings so i know ive configured php fine.
also i followed a mysql installation tutorial step by step and have created tables and populated them, so thats working fine.
any ideas?
thanks.