Need help connecting to DB using PHP
Hi
I am unable to connect to any databases using a test PHP script.
I have PHP compiled to work with Mysql so it's not that, I already have about 10 phpNuke sites using MySQL and they all work fine. Also register_globals is turned on in php.ini.
Here is my test script called test.php
~~~~~~~~~Code~~~~~~~~~~~~
<?php
$db = mysql_connect("localhost", "root", "");
{
die ("Didnt Connect");
}
mysql_select_db("Travel_Desk",$db);
{
die ("No connection");
}
$result = mysql_query("SELECT * FROM td_travel",$db);
printf("First Name: %s<br>\n", mysql_result($result,0,"name", ""));
?>
~~~~~End of Code~~~~~~~~~
When I run this from a browser I get the error "Didnt Connect"
I can access the Travel_Desk DB no problem from the command line as root. The DB has one table called td_travel and has 6 fields in it with one of them being called 'name'.
Can someone please give me some idea as to why this isn't working.
Cheers
amp2000
|