gpt4 book ai didi

php - mysqli 准备语句错误 - 过程样式

转载 作者:行者123 更新时间:2023-12-03 07:54:08 25 4
gpt4 key购买 nike

这个问题在这里已经有了答案:





How to deal with mysqli problems? mysqli_fetch_array(): Argument #1 must be of type mysqli_result

(1 个回答)


6年前关闭。




我刚读了this它清楚地解释了面向对象样式的错误处理。

This页面也解释了相同的。

我想知道如何查找准备好的语句是否失败,以及错误是什么。

$stmt = mysqli_prepare(ConnectionObject,Query);
if($stmt == false)
{
// Found statement fails
// How to find what is the error
// mysqli_stmt_error($stmt); It will fail because $stmt is boolean[false].
}

如何找到确切的错误?

最佳答案

您可以使用 mysqli_error :

$stmt = mysqli_prepare(ConnectionObject, $query);
if(!$stmt) {
printf("Cannot prepare query <%s>. Error message: %s\n",
$query, mysqli_error(ConnectionObject));
}

关于php - mysqli 准备语句错误 - 过程样式,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32935815/

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