我得到這個錯誤訪問我的網站。我爲三臺不同的服務器使用了相同的文件,包括我的本地服務器,並且運行良好。有人可以點亮一些燈嗎?mysql_num_rows()期望參數1是資源,php錯誤
$stringIp = $_SERVER['REMOTE_ADDR'];
$intIp = ip2long($stringIp);
$inDB = @mysql_query("SELECT 1 FROM av_whoIsOnline WHERE 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?)';
}
mysql_connect('localhost','mysql_user','mysql_password')? – Andrew
'SELECT 1 FROM'?爲什麼有人會提供這樣的名字? –
並在哪一行報告錯誤? – 2014-03-06 07:43:27