我運行一個MySQL查詢選擇一些數據,有時我叫MySQL查詢錯誤驗證
mysql_fetch_assoc() expects parameter 1 to be resource, boolean given
一個錯誤,當我執行這個下面的代碼,
$result = $this->db->execute($sql);
for ($i = 0; $data[$i + 1] = mysql_fetch_assoc($result); $i++);
array_pop($data);
如何優化這個編碼防止任何錯誤?
它有什麼問題嗎?我應該忽略這個錯誤嗎?
不要練習使用mysql_了,它不知何故被棄用。 – witherwind