简体   繁体   English

mysql num行失败了

[英]mysql num rows is failing

$result=mysql_query("SELECT * FROM users WHERE pass='".sha1($_POST['mainloginpass'])."'");

if(mysql_num_rows($result)==1){

it says that "mysql_num_rows() expects parameter 1 to be resource, boolean given" 它说“mysql_num_rows()期望参数1是资源,布尔给定”

mysql_query normally returns a resource, but according to the docs : mysql_query通常会返回一个资源,但根据文档
mysql_query() will return FALSE on error and also fail and return FALSE if the user does not have permission to access the table(s) referenced by the query. 如果用户没有访问查询引用的表的权限,mysql_query()将在出错时返回FALSE并失败并返回FALSE。

You may want to try something like this: 您可能想尝试这样的事情:

if (!$result) {
    die('Invalid query: ' . mysql_error());
}

To see what the problem is. 看看问题是什么。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM