Jump to content


Photo

MySQL_nuM_rows problem


  • Please log in to reply
1 reply to this topic

#1 Stackout

Stackout
  • Members
  • Pip
  • Newbie
  • 1 posts
  • LocationColorado

Posted 14 March 2006 - 01:17 AM

Hey, I've got a question. Why do I get the error

Warning: mysql_num_rows(): supplied argument is not a valid MySQL result resource in C:\WEBS\webdirectory\online.php on line 38

Some odd reason I just don't see the problem. Coudl someone point me to what is wrong? Here is the code:
$sql = mysql_query("SELECT * FROM ".$sql_prefix."users_online WHERE country = '".ip2country($ip)."'",$conn);
if(mysql_num_rows($sql) > 0){
    $select_tes_lgi = mysql_query("SELECT * FROM ".$sql_prefix."visits WHERE ip = '".$ip."' LIMIT 1",$conn);
    if(mysql_num_rows($select_tes_lgi) != 0){
        $sel = dosql($sql,1);
        $hit_add = (($sel[0][2]) + (1));
        mysql_query("UPDATE ".$sql_prefix."visits_status SET hits = '".$hit_add."' WHERE country = '".ip2country($ip)."'");
    }
}else{
    mysql_query("INSERT INTO ".$sql_prefix."visits_status (hits,country) VALUES ('1','".ip2country($ip)."')");
}

I just don't see the problem. Thanks if someone could help.
[url=http://aaotactics.com][/url]

#2 Steveo31

Steveo31
  • Members
  • PipPip
  • Member
  • 25 posts
  • LocationSan Jose, CA

Posted 14 March 2006 - 01:28 AM

Try adding "or die(mysql_error())" to the query it is referring to. If the rows arguement is throwing a fit, it's usually becuase the query isn't correct.




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users