1

I have some pretty simple code that's not throwing an exception on a client server.

The problem is that the table mytable doesn't exist. Fair enough. But then it should throw an exception... or is there some unusual MySqli setup that would prevent an exception from being thrown?

Code is below:

    $query = "DROP TABLE `mytable`";
    try {
        $db->query($query);
    }
    catch (Exception $e) {
        //LOG THE ERROR
    }
barns
  • 352
  • 2
  • 13
  • Did you try adding error reporting to the top of your file(s) `error_reporting(E_ALL); ini_set('display_errors', 1);` - `try/catch` may not be enough. What about adding `print $e->getMessage();` – Funk Forty Niner May 22 '14 at 20:41
  • 2
    Have you set `$db->report_mode = MYSQLI_REPORT_ERROR | MYSQLI_REPORT_STRICT;` – Mark Baker May 22 '14 at 20:43
  • Great work Mark - it was the MYSQL_REPORT_STRICT that was needed. Thanks! – barns May 23 '14 at 22:12

0 Answers0