List:MySQL on Win32« Previous MessageNext Message »
From:Paul DuBois Date:March 15 2003 7:37pm
Subject:Re: Can't connect to db via a php script
View as plain text  
At 6:35 +0000 3/11/03, J. McGregor wrote:
>I'm just learning the basics of mysql (as well as php and apache). I've
>created a simple script to test that I can connect to mysql via my
>browser and a php file.
>
><?php
>$conn = mysql_connect ("localhost", "username", "password");
>echo "$conn";
>?>
>
>I can get a connection index ok but when I try to connect and select a
>database:
>
><?php
>$conn = mysql_connect ("localhost", "username", "password");
>mysql_select_db("test",$conn);
>?>
>
>I get a message window saying "The document contained no data. Try again
>later, or contact the server's administrator".

That's because in the second case you don't print anything.
Just print "Connection successful" or something and the message will
go away.

However, you really should check the results of your function calls.
As written, you don't know whether or not they really succeeded.

>I've granted "username", "password" access to "test" to no avail.
>
>Any assistance would be greatly appreciated.
>
>Jim


-- 
Paul DuBois
http://www.kitebird.com/
sql, query
Thread
Can't connect to db via a php scriptJ. McGregor11 Mar
  • Re: Can't connect to db via a php scriptPaul DuBois15 Mar