|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2020-10-19 13:35 UTC] webmaster at seobytes dot eu
[2020-10-19 15:07 UTC] requinix@php.net
-Status: Open
+Status: Not a bug
[2020-10-19 15:07 UTC] requinix@php.net
[2020-10-20 06:18 UTC] webmaster at seobytes dot eu
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Tue Oct 28 13:00:01 2025 UTC |
Description: ------------ When executing a prepared statement to UPDATE a date in some row, then unsetting the variable and then executing the prepared statement again, redeclaring the variable and setting a new date to UPDATE a different ROW, the date written in the database does not change compare with the first execution despite the variable displaying the proper value just ahead of execution, although execution to UPDATE a date in a loop does not cause any issue. Tested on windows server and Linux server. PHP 7.2 and 7.3 Test script: --------------- $conn = new mysqli($servername, $username, $password, $db); $stmt=$conn->prepare("UPDATE _products SET product_available_date=? WHERE product_sku=?"); $stmt->bind_param("ss", $product_available_date,$product_sku); $product_available_date='2020-10-19'; $product_sku='some_value'; $stmt->execute(); unset($product_available_date); $product_available_date = '2020-12-10'; $product_sku=mysqli_real_escape_string($conn,'someother_value'); echo $product_sku.' '.$product_available_date.'<br>'; $stmt->execute(); $stmt->close(); $conn->close(); Expected result: ---------------- I expect that the value for the variable to be updated in the bind statement as it correctly happen within a loop without the need to close the first statement after execution and redeclaring the prepared statement. Actual result: -------------- When written on two lines, and even when unsetting the date, the new value for the date is not passed on to the prepared statement event though the string is correctly passed.