What are common pitfalls when using PHP with SQL databases, specifically regarding data types in queries?

One common pitfall when using PHP with SQL databases is mismatched data types in queries, which can lead to errors or unexpected results. To avoid this issue, always ensure that the data types in your SQL queries match the data types of the columns in your database tables.

// Example of a query with mismatched data types
$sql = "SELECT * FROM users WHERE age = '25'";

// Fix the query by using the correct data type for the age column
$sql = "SELECT * FROM users WHERE age = 25";