PHP mysqli 更新表中的 blob 值不执行任何操作

发布于 2024-08-22 11:53:09 字数 406 浏览 7 评论 0原文

我有一个名为 $description 的变量,其中包含一段信息。其中一些描述是一个或两个句子,有些很长,所以我使用 blob 而不是 var char 来保存它。该语句执行时没有问题,但实际上没有保存任何内容。没有报告错误。

$query = "UPDATE event SET description=? WHERE id=? LIMIT 1";
if($stmt = $db -> prepare($query))
{
    $null = NULL;
    $stmt -> bind_param("bi", $null, $id);
    $stmt -> send_long_data(0, $description);
    $stmt -> execute();
}

我缺少什么吗?

I have a variable called $description that has a paragraph of information in it. Some of these descriptions are a sentence or 2, some are long, so im using blobs to save this instead of var char. This statement executes without a problem, but nothing actually gets saved. No errors reported.

$query = "UPDATE event SET description=? WHERE id=? LIMIT 1";
if($stmt = $db -> prepare($query))
{
    $null = NULL;
    $stmt -> bind_param("bi", $null, $id);
    $stmt -> send_long_data(0, $description);
    $stmt -> execute();
}

Is there something im missing?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

夏日浅笑〃 2024-08-29 11:53:09

不要将 b 绑定为 blob,而是尝试将 s 引用为 string

Instead of binding b as blob, try to refer to s as string

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文