Q:

fail with no error with mysqli prepare statement

I have these lines in a small php script :
    $sql = "UPDATE activation SET end = NOW(), deactivated_by = ? WHERE id=?;";
    $stmt = $mysqli->prepare($sql);
    if(!$stmt) {die('prepare4 failed: ' . htmlspecialchars($mysqli->error));}

But I get this result with no error nor in the response, nor in apache error.log...
prepare4 failed:

Any idea what's going on, or how to get more information on this ?
Edit
if (!$stmt) {
    die('prepare4 failed: ' .$mysqli->errno."----"  . $mysqli->error);
}

returns prepare4 failed: 0------
We can exclude problems from htmlspecialchars
Edit2
Ok, I found how to enable mysql reports with :
$driver = new mysqli_driver();
$driver->report_mode = MYSQLI_REPORT_ALL;

Now, I get Commands out of sync; you can't run this command now
No idea why I get that, though. But at least I have something to look after now.

A:

To fix the fact that the error message was not displaying, I added :
$driver = new mysqli_driver();
$driver->report_mode = MYSQLI_REPORT_ERROR | MYSQLI_REPORT_STRICT;

just after creating my mysqli object. This way I was raising mysql errors when they occured.
The error I got was "Commands out of sync; you can't run this command now", which indicates that I was trying to create a new statement before closing the previous one.
There was a missing $stmt->close(); before the call to mysqli->prepare().

