LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (https://www.linuxquestions.org/questions/programming-9/)
-   -   Need help connecting to DB using PHP (https://www.linuxquestions.org/questions/programming-9/need-help-connecting-to-db-using-php-48216/)

amp2000 03-04-2003 11:17 AM

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

amp2000 03-04-2003 03:25 PM

Never mind, I corrupted all my databases, see http://www.linuxquestions.org/questi...threadid=48262


All times are GMT -5. The time now is 02:31 PM.