What are common syntax errors to watch out for when constructing SQL queries in PHP, particularly for UPDATE statements?

Common syntax errors to watch out for when constructing SQL queries in PHP, particularly for UPDATE statements, include missing commas between column-value pairs, forgetting to enclose string values in single quotes, and improper spacing. To avoid these errors, double-check the syntax of your query and ensure all elements are properly formatted.

// Example of an UPDATE statement with proper syntax
$sql = "UPDATE table_name SET column1 = 'value1', column2 = 'value2' WHERE condition";
$result = mysqli_query($connection, $sql);

if ($result) {
    echo "Update successful";
} else {
    echo "Error updating record: " . mysqli_error($connection);
}