mysql_num_rows() expects parameter 1 to be resource, php error -


i getting error accessing site. have used same files 3 different servers, including local server , it's running fine. can shed lights?

    $stringip = $_server['remote_addr']; $intip = ip2long($stringip);   $indb = @mysql_query("select 1 av_whoisonline ip=".$intip);  if(!mysql_num_rows($indb)) //code in question <--------- {   if($_cookie['geodata']) {  list($city,$countryname,$countryabbrev) =     explode('|',mysql_real_escape_string(strip_tags($_cookie['geodata']))); } else {   $xml = file_get_contents('http://api.hostip.info/?ip='.$stringip);  $city = get_tag('gml:name',$xml); $city = $city[1];  $countryname = get_tag('countryname',$xml); $countryname = $countryname[0];  $countryabbrev = get_tag('countryabbrev',$xml); $countryabbrev = $countryabbrev[0];   setcookie('geodata',$city.'|'.$countryname.'|'.$countryabbrev, time()+60*60*24*30,'/'); }  $countryname = str_replace('(unknown country?)','unknown',$countryname);  if (!$countryname) { $countryname='unknown'; $countryabbrev='xx'; $city='(unknown city?)'; } 

take out @ sign before @mysql_query. suppresses errors. if error, $indb not valid resource, error getting. problem in line before.

also note mysql library has been deprecated in favour of mysqli , pdo. consider changing code use 1 of newer libraries since safer


Comments

Popular posts from this blog

c# - How to get the current UAC mode -

angularjs - ng-repeat duplicating items after page reload -

javascript - What's causing this slow/delayed audio playback in Safari? -