[英]Warning mysql_num_rows(): supplied argument is not a valid MySQL result
Why i have this error and how to fix this, I've double checked everything and all is okay 为什么我有此错误以及如何解决此问题,所以我仔细检查了所有内容,一切正常
Warning : mysql_num_rows(): supplied argument is not a valid MySQL result resource in
/home/sharinga/public_html/ccccc.com/app/like/like.php on line
15
警告 :mysql_num_rows():第
15行上
/home/sharinga/public_html/ccccc.com/app/like/like.php中提供的参数不是有效的MySQL结果资源
You have an error in your SQL syntax;您的SQL语法有误; check the manual that corresponds to your MySQL server version for the right syntax to use near 'like WHERE postID='81' AND userIP='2x2.2x0.x5.xxx'' at line 1
检查与您的MySQL服务器版本相对应的手册以获取正确的语法,以在第1行的'like WHERE postID = '81'AND userIP ='2x2.2x0.x5.xxx'附近使用
Here is sql 这是SQL
$ip_sql = mysql_query("SELECT userIP FROM like WHERE postID='$id' AND userIP='$ip'");
$count = mysql_num_rows($ip_sql) or die(mysql_error());
if($count==0)
{...
LIKE
是保留字-请将其转义
$ip_sql = mysql_query("SELECT userIP FROM `like` WHERE postID='$id' AND userIP='$ip'");
LIKE
是SQL中的关键字,使用´
SELECT userIP FROM `like` WHERE postID='$id' AND userIP='$ip
Try connecting first. 尝试先连接。 Are you looking for the null case?
您是否在寻找无效的情况? If so you have to search a certain row not $count as a whole.
如果是这样,则必须搜索特定的行而不是整个$ count。
$conn = mysql_connect("localhost", "user", "pass");
$ip_sql = mysql_query("SELECT userIP FROM like WHERE postID='$id' AND userIP='$ip'",$conn);
$count = mysql_num_rows($ip_sql) or die(mysql_error());
if ($count['postID'}==""){
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.