What common syntax errors can occur when querying a MySQL database in PHP?

One common syntax error when querying a MySQL database in PHP is forgetting to enclose table or column names in backticks (`) if they contain special characters or are MySQL reserved words. Another common mistake is missing a semicolon at the end of the query. To solve these issues, always enclose table and column names in backticks and ensure each query statement ends with a semicolon.

// Example query with backticks and semicolon
$query = "SELECT `column1`, `column2` FROM `table_name` WHERE `column3` = 'value';";
$result = mysqli_query($connection, $query);