我有以下代码,我想知道 mysqli_query
是否返回任何行,如果返回则返回错误.
I have the following code and I would like to know if mysqli_query
returned any rows and if so return an error.
$result = mysqli_query($connection, "SELECT * FROM users");
if ($result == "") {
echo "No records found";
} else {
echo "There is at least one record in the database";
}
如果结果返回为空,我就会遇到麻烦.我已经尝试使用了几种东西,但如果没有找到任何东西,我无法弄清楚如何让它正常工作.
I'm having trouble if the results come back as empty. I've tried using several things and can't figure out how to get it work correctly if nothing is found.
使用 mysqli_num_rows 检查是否有任何行返回.
Use mysqli_num_rows to check if any rows were returned or not.
这篇关于检查 mysqli_query 是否返回任何值?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!