Page 1 of 1

sql problem

Posted: Sun Jul 11, 2004 10:43 pm
by FCB
i'm strikin out 2night...

Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in /home/fleet54/public_html/ezp2/global_fns.php on line 160

Code: Select all

$h1 = mysql_query("select * from '$table' where type = 1");
$q1 = mysql_num_rows($h1);
any help is appreciated
~FCB

Posted: Sun Jul 11, 2004 10:51 pm
by d3ad1ysp0rk
Is $table set?

Try

Code: Select all

$h1 = mysql_query("select * from {$table} where type = 1");
$q1 = mysql_num_rows($h1);

Posted: Sun Jul 11, 2004 10:53 pm
by feyd
try

Code: Select all

<?php

$h1 = mysql_query("select * from '$table' where type = 1") or die(mysql_error());
$q1 = mysql_num_rows($h1);

?>
I believe 'type' is a reserved word in sql.. It may be complaining about '$table' too.. in which case, you'll need to backtick the names

Code: Select all

<?php

$h1 = mysql_query("select * from `$table` where `type` = 1") or die(mysql_error()); 
$q1 = mysql_num_rows($h1);

?>

Posted: Sun Jul 11, 2004 10:55 pm
by FCB
augh, i miss-spelled something when i called the function... i hate typing, lol thanks for trying!

~FCB