In my code, I execute several valid SQL statements. But one of statement was invalid ($mysqli->prepare returns false), but no error code was returned ($mysqli->error returns false).
Here an example of the code:
$mysqli = new mysqli('host', 'user', 'password', 'database');
// First query (valid)
if(($oStatement = $mysqli->prepare('SELECT column FROM table;')) === false)
throw new Exception('Error in statement: ' . $mysqli->error);
// ...
// Second query (invalid)
if(($oStatement = $mysqli->prepare('SELECT column_which_doesnt_exist FROM table;')) === false)
throw new Exception('Error in statement: ' . $mysqli->error);
Why doesn't it return the error message?