PHP PDO. error number #39;00000#39; when query is correct(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"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:PHP PDO.查询正确时的错误号“00000"


- 覆盖 Magento 社区模块控制器的问题 2022-01-01
- 如何使用 Google API 在团队云端硬盘中创建文件夹? 2022-01-01
- openssl_digest vs hash vs hash_hmac?盐与盐的区别HMAC? 2022-01-01
- Laravel 5:Model.php 中的 MassAssignmentException 2021-01-01
- Oracle 即时客户端 DYLD_LIBRARY_PATH 错误 2022-01-01
- 如何从数据库中获取数据以在 laravel 中查看页面? 2022-01-01
- PHP foreach() 与数组中的数组? 2022-01-01
- 如何在 Symfony2 中正确使用 webSockets 2021-01-01
- 使用 GD 和 libjpeg 支持编译 PHP 2022-01-01
- PHP - if 语句中的倒序 2021-01-01