本文介紹了PHP PDO.查詢正確時的錯誤號“00000"的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!
問題描述
我有以下代碼:
$sql3 = "update news set date='$time' where id='2'";
$sql3 = $connect->exec($sql3);
if(!$sql3)
{
print_r($connect->errorInfo());
$error = $connect->errorInfo();
die ("Error: (".$error[0].':'.$error[1].') '.$error[2]);
}
運行腳本時,有時會收到錯誤編號00000".我的意思是它介紹了 IF
.而且都是隨機的.輸出(有時):
When I run the script, sometimes I get error number '00000'. I mean it goes intro the IF
. and it is all random. output (sometimes):
Array ( [0] => 00000 [1] => [2] => )
我應該怎么做才能解決這個問題?
PS:腳本每次都正確執行.
What should I do to fix this problem ?
PS: The script executes correctly every time.
推薦答案
PDO 錯誤代碼 00000
表示一切正常.您遇到錯誤檢查代碼的原因是 $sql3
返回 0(沒有行受到影響)并且 PHP 將其評估為 false.嘗試明確檢查 return false;
The PDO error code 00000
means that everything works fine. The reason you're hitting the error-checking code is that $sql3
is returning 0 (no rows were effected) and PHP evaluates that to false. Try explicitly checking for a return false;
if($sql3 === false)
這篇關于PHP PDO.查詢正確時的錯誤號“00000"的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!
【網站聲明】本站部分內容來源于互聯網,旨在幫助大家更快的解決問題,如果有圖片或者內容侵犯了您的權益,請聯系我們刪除處理,感謝您的支持!