gpt4 book ai didi

PHP/MySQL : What is returned when no matches are found?

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

我想使用 PHP 来查明是否没有找到匹配项。我尝试了以下操作,但“is_resource()”始终返回 true。

$result = mysql_query('...');
if(is_resource($result)){
// Results are found
}

最佳答案

mysql_num_rows() 可以解决问题。

if (mysql_num_rows($result)>0) {
//Results are found
}

http://php.net/manual/en/function.mysql-num-rows.php

关于PHP/MySQL : What is returned when no matches are found?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6666223/

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