遇到的問題即時消息是,MySQL的NUM行不會工作,除非用戶ID爲1混淆問題的mysqli功能
如果別的它會顯示這個
Warning: mysqli_num_rows() expects parameter 1 to be mysqli_result, boolean given in /home/theclear/public_html/redline/class/class_db_mysqli.php on line 66
呼籲部分麻木行:
$rrr=$db->query("SELECT * FROM referals WHERE refREFER={$r['userid']}");
print $db->num_rows($rrr);
和從class_db_mysqli.php功能(包括66行):
function num_rows($result=0)
{
if(!$result) { $result=$this->result; }
return mysqli_num_rows($result);
}
我不能工作了,爲什麼它工作正常,如果用戶id = 1但如果用戶id> 1 ....
據我可以找出...
林 - >標識1 你是 - > Id2的
$userid=$_GET['u']
如果我訪問 domain.xxx/file.php?u=1
沒有錯誤,並顯示正確的結果。
如果我訪問 domain.xxx/file.php?u=2
Warning: mysqli_num_rows() expects parameter 1 to be mysqli_result, boolean given in /home/theclear/public_html/redline/class/class_db_mysqli.php on line 66
顯示
http://php.net/manual/en/mysqli.error.php – zerkms
錯誤似乎是由於數據庫中的數據不正確,而與代碼無關。 – user3147145
它永遠不會是這樣。如果你的查詢語法錯誤失敗 - 這是你的錯誤 – zerkms