<?php
/* activate reporting */
mysqli_report(MYSQLI_REPORT_ALL);
try {
$link = mysqli_connect("localhost", "my_user", "my_password", "my_db");
/* this query should report an error */
$result = mysqli_query($link, "SELECT Name FROM Nonexistingtable WHERE population > 50000");
/* this query should report a bad index if the column population doesn't have an index */
$result = mysqli_query($link, "SELECT Name FROM City WHERE population > 50000");
} catch (mysqli_sql_exception $e) {
error_log($e->__toString());
}