gpt4 book ai didi

php - mysql num rows 失败

转载 作者:行者123 更新时间:2023-11-29 05:00:08 25 4
gpt4 key购买 nike

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

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

它说“mysql_num_rows() 期望参数 1 是资源,给定 bool 值”

最佳答案

mysql_query 通常返回资源,但根据 the docs :
mysql_query() 将在出错时返回 FALSE,如果用户无权访问查询引用的表,也会失败并返回 FALSE。

你可能想尝试这样的事情:

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

看看是什么问题。

关于php - mysql num rows 失败,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/1990394/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com