Jump to content

Recommended Posts

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

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

Some odd reason I just don't see the problem. Coudl someone point me to what is wrong? Here is the code:
[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)."')");
}[/code]

I just don't see the problem. Thanks if someone could help.
Link to comment
https://forums.phpfreaks.com/topic/4890-mysql_num_rows-problem/
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.