How can error reporting be improved in PHP to identify syntax errors in MySQL queries?

To improve error reporting in PHP for syntax errors in MySQL queries, you can enable error reporting for MySQL queries by setting the `MYSQLI_REPORT_ERROR` flag. This will make PHP throw exceptions for MySQL errors, including syntax errors in queries.

mysqli_report(MYSQLI_REPORT_ERROR);