I am trying to update data in the database using PHP prepared statements, but there is an error that I cannot resolve. This error appears in the first line of the code and the error message isWarning: mysqli::prepare(): Couldn't fetch mysqli in C:wamp64wwwnewjornalentryedit.php on line 266
and the line 266 is $stmt = $con->prepare("UPDATE jentress_erp SET date=?, description=?, position=?WHERE token_serial =? AND company=?");
: Prepare failed. I couldn’t solve it despite making many changes and modifications to the code, and all attempts have failed. Please review the code and correct it , All variables in the query statement are correct, defined, and have values, and all column names in the query statement actually exist in the jentress_erp
table. The connection to the database is also working well in the page.
php code:
$stmt = $con->prepare("UPDATE jentress_erp
SET date=?, description=?, position=?
WHERE token_serial =? AND company=?");
$stmt->bind_param("sssss", $test_date, $descrip, $_path, $get_data, $company);
$stmt->execute();
$stmt->close();