從我的研究中我明白,應該在操作/使用查詢數據後釋放結果集數據。我試圖使用mysqli_result::free
PDO下面的代碼方面:免費結果設置數據mysqli_result ::免費
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();
}
我收到消息: 致命錯誤:調用未定義的方法PDOStatement對象::免費()在...
我有在http://php.net/manual/en/mysqli-result.free.php以及Google上進行了研究,結果沒有找到示例代碼來進一步闡明其應用。
在這個網站的例子:mysqli_result::free increase php memory usage 這裏很混亂:不應該在這段代碼$row
被釋放?
這裏Are mysqli_result::free and mysqli_stmt::free_result the same?
這裏的free_result()
和free()
兩種形式一起使用。
我似乎無法找到我的錯誤或明確的用法示例。我將不勝感激任何意見。