What common syntax errors should PHP developers be aware of when working with MySQL databases?

One common syntax error that PHP developers should be aware of when working with MySQL databases is not properly escaping strings before inserting them into queries. This can lead to SQL injection attacks. To prevent this, developers should use prepared statements or parameterized queries to safely insert user input into SQL queries.

// Example of using prepared statements to safely insert user input into a MySQL query
$stmt = $pdo->prepare("INSERT INTO users (username, password) VALUES (:username, :password)");
$stmt->bindParam(':username', $username);
$stmt->bindParam(':password', $password);
$stmt->execute();