Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Rhinorhino on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Local correct but not on the internet

Status
Not open for further replies.

michelleqw

Programmer
Joined
Jan 4, 2004
Messages
120
Location
DE
Dear PHP users,

We have made a simple code what is working correctly local but on the internet it gives the next error message:

Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in / on line 18

Can someone tell us what us is going wrong????
code:
$db_link = mysql_connect("localhost", "root", " QQ") or die ("couldn't connect to MySQL\n");
mysql_select_db("QQ", $db_link) or die ("no selection\n");

$result = mysql_query("select * from tblcount", $db_link);
$values = mysql_fetch_array($result, MYSQL_ASSOC) ; <<<<line 18

Nice regeads,

Michelle
 
You're getting that error because your invokation of mysql_query() is failing and returning FALSE instead of a resource handle.

It's difficult to say why this would be happening because your code is not trapping enough errors.

At the very least, I recommend that you change this line:

$result = mysql_query("select * from tblcount", $db_link);

To read:

$result = mysql_query("select * from tblcount", $db_link) [blue] or die (mysql_error())[/blue];



Want the best answers? Ask the best questions!

TANSTAAFL!!
 
I found the solution. Local is the php more pardonable ason internet.
The tblcount was in my mysql database tblCount. The case sensitivity was th cause of the problem.

Michelle.
 
Local: Windows
Remote: Unix
RIght?
 
it'll getcha every time...case sensitivy is the biggest hurdle we have moving from ASP to PHP


Bastien

Cat, the other other white meat
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top