How can error_reporting be set up in PHP to effectively debug SQL syntax errors?

When debugging SQL syntax errors in PHP, it is important to set the error_reporting level to display all errors, including those related to SQL queries. This can be achieved by setting error_reporting to E_ALL in your PHP script. Additionally, enabling display_errors can help in identifying and fixing SQL syntax errors more effectively.

<?php
error_reporting(E_ALL);
ini_set('display_errors', 1);

// Your PHP code with SQL queries here
?>