gpt4 book ai didi

php - 免费结果集数据 mysqli_result::free

转载 作者:行者123 更新时间:2023-11-30 22:37:25 25 4
gpt4 key购买 nike

根据我的研究,我了解到应该在操作/使用查询数据后释放结果集数据。我正在尝试在以下代码上下文中使用 mysqli_result::free pdo:

if ($result) 
{ $change = $result[0][9];
$change = $change+1;
$sql='UPDATE users SET visits = :visit WHERE username = :username';
$q=$dbh->prepare($sql);
$q->bindValue(':username',$username,PDO::PARAM_STR);
$q->bindValue(':visit',$change,PDO::PARAM_INT);
$q->execute();
// initiate SESSION and Set USER SESSION Variables through the --session_handler.php
require ('./includes/session_handler.php');
//Free the Query Result set to free memory on the database handler
$result->free();
// direct registered users to MEMBER_ZONE.php for registered users interface
header('Location: member_zone.php');
exit();
}

我收到消息: fatal error :在...中调用未定义的方法 PDOStatement::free()

我研究过 http://php.net/manual/en/mysqli-result.free.php以及在谷歌上,没有找到进一步阐明其应用的示例代码。

在这个网站上的例子:mysqli_result::free increase php memory usage这里令人困惑:不应该在这段代码中释放 $row 吗?

这里Are mysqli_result::free and mysqli_stmt::free_result the same?

这里结合使用了free_result()free()两种形式。

我似乎找不到我的错误或明确的用法示例。我将不胜感激任何意见。

最佳答案

似乎我在结果上使用了 $q->free(),但结果从未出现,因为我正在更新数据库,而不是请求结果。语法似乎被正确使用。这是我认为错误的使用顺序。

关于php - 免费结果集数据 mysqli_result::free,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32104988/

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