Forum Moderators: coopster

Message Too Old, No Replies

mysql num rows(): invalid argument suplied

Any debugging tips?

         

Robeysan

6:20 am on Jan 28, 2009 (gmt 0)

10+ Year Member




$sql = "SELECT * FROM RESELLER WHERE SITENAME = ".$sitename." ";
$result = mysql_query($sql);
$inuse = mysql_num_rows($result);

Hello all,
I am getting this error "Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in..." I have scowered this code and can not find the reason this is happening. Please suggestion this problem has me stumped.
Thanks,
Robeysan

Robeysan

6:24 am on Jan 28, 2009 (gmt 0)

10+ Year Member



WOOT! I figured it out!

$sql = "SELECT * FROM RESELLER WHERE SITENAME = ".$sitename." ";

The variable $sitename should have been surrounded by single quotes as well!

Like so:


$sql = "SELECT * FROM RESELLER WHERE SITENAME = '".$sitename."' ";

Sorry about that guys, as soon as I posted this I figured it out ;) thanks anyway
-Robeysan

[edited by: Robeysan at 6:25 am (utc) on Jan. 28, 2009]