本文介紹了檢查 mysqli_query 是否返回任何值?的處理方法,對(duì)大家解決問(wèn)題具有一定的參考價(jià)值,需要的朋友們下面隨著小編來(lái)一起學(xué)習(xí)吧!
問(wèn)題描述
我有以下代碼,我想知道 mysqli_query
是否返回任何行,如果返回則返回錯(cuò)誤.
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";
}
如果結(jié)果返回為空,我就會(huì)遇到麻煩.我已經(jīng)嘗試使用了幾種東西,但如果沒(méi)有找到任何東西,我無(wú)法弄清楚如何讓它正常工作.
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.
這篇關(guān)于檢查 mysqli_query 是否返回任何值?的文章就介紹到這了,希望我們推薦的答案對(duì)大家有所幫助,也希望大家多多支持html5模板網(wǎng)!
【網(wǎng)站聲明】本站部分內(nèi)容來(lái)源于互聯(lián)網(wǎng),旨在幫助大家更快的解決問(wèn)題,如果有圖片或者內(nèi)容侵犯了您的權(quán)益,請(qǐng)聯(lián)系我們刪除處理,感謝您的支持!