Is it possible to specify that MySQLi sends any errors and warnings to the PHP default ‘error_log’ directive? I can’t seem to find any error options for the class specification, and I don’t wish to handle errors manually like so:
if ($result = $mysqli->query("...")) { }
else
handle $mysqli->error;
Well, one way would be to override the class:
Then just use as normal, except instead of creating an connection via
new MySQLi(), usenew myMySQLi(). Other than the error handling, it’ll run just the same. I do this quite often, to throw exceptions on errors and to add additional functionality to MySQLi…