By default PHP doesn’t show run time error. You will have to
set error method as follows
// first set general PHP error reporting
// in order to be sure we will see every error in the scriptini_set('display_errors',1);error_reporting(E_ALL);
/*** THIS! ***/mysqli_report(MYSQLI_REPORT_ERROR | MYSQLI_REPORT_STRICT);/*** ^^^^^ ***/$db = $mysqli = new mysqli($host, $user, $pass, $database);
$res = $db->query("apparently not valid SQL string");$res->fetch_assoc();
Fatal error: Uncaught exception 'mysqli_sql_exception'with message 'You have an error in your SQL syntax;
check the manual that corresponds to your MySQL server version
for the right syntax to use near
'apparently not valid SQL string' at line 1' in /home/www/test.php:16
Stack trace:#0 /home/www/init.php(16): mysqli->query('apparently not ...')
#1 /home/www/test.php(2): include('/home/www/...')
#2 {main}
thrown in /home/www/init.php on line 16
No comments:
Post a Comment