gpt4 book ai didi

php - PDO:sqlite不插入数据,但没有错误

转载 作者:行者123 更新时间:2023-12-03 02:16:48 27 4
gpt4 key购买 nike

try
{
$res = $db->exec($sql);
if ($res === FALSE)
{
print_r($db->errorInfo());
die();
}
}
catch(PDOException $e)
{
die($e->getCode().':'.$e->getMessage());
}
catch(Exception $e)
{
die($e->getCode().':'.$e->getMessage());
}

没有错误信息,也不会被捕获为异常。然而 $res 为 FALSE,并且没有插入任何数据。

Array
(
[0] =>
)

但是当我回显 $sql 并在 SQLiteManager 中输入该查询时,它可以插入数据。

最佳答案

我仅在 Python 中使用 sqlite,但我必须在那里提交插入/更新语句...也许这里也是这种情况? http://docs.php.net/manual/en/pdo.commit.php

关于php - PDO:sqlite不插入数据,但没有错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2683405/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com