PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
Moderator: General Moderators
FCB
Forum Newbie
Posts: 8 Joined: Mon Jun 21, 2004 6:12 pm
Post
by FCB » Sun Jul 11, 2004 10:43 pm
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
d3ad1ysp0rk
Forum Donator
Posts: 1661 Joined: Mon Oct 20, 2003 8:31 pm
Location: Maine, USA
Post
by d3ad1ysp0rk » Sun Jul 11, 2004 10:51 pm
Is $table set?
Try
Code: Select all
$h1 = mysql_query("select * from {$table} where type = 1");
$q1 = mysql_num_rows($h1);
feyd
Neighborhood Spidermoddy
Posts: 31559 Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA
Post
by feyd » Sun Jul 11, 2004 10:53 pm
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);
?>
FCB
Forum Newbie
Posts: 8 Joined: Mon Jun 21, 2004 6:12 pm
Post
by FCB » Sun Jul 11, 2004 10:55 pm
augh, i miss-spelled something when i called the function... i hate typing, lol thanks for trying!
~FCB