When executing a prepared MySQL, by default if there's an error then you'll simply get FALSE returned from your call to prepare().
To get the full MySQL error back create a statement object before preparing your query as such:
<?php
$mysqli = new mysqli("localhost", "my_user", "my_password", "world");
if (mysqli_connect_errno()) {
printf("Connect failed: %s\n", mysqli_connect_error());
exit();
}
$city = "Amersfoort";
$statement = $mysqli->stmt_init();
if ($statement->prepare("SELECT District FROM City WHERE Name=?")) {
$statement->bind_param("s", $city);
if (!$statement->execute()) {
trigger_error('Error executing MySQL query: ' . $statement->error);
}
$statement->bind_result($district);
$statement->fetch();
printf("%s is in district %s\n", $city, $district);
$statement->close();
}
$mysqli->close();
?>