What are some potential pitfalls of not understanding MySQL when working with PHP?

One potential pitfall of not understanding MySQL when working with PHP is the risk of SQL injection attacks, where malicious code can be injected into SQL statements, potentially leading to data breaches or unauthorized access. To prevent this, it is important to use prepared statements and parameterized queries when interacting with the database.

// Example of using prepared statements to prevent SQL injection
$stmt = $pdo->prepare("SELECT * FROM users WHERE username = :username");
$stmt->bindParam(':username', $username);
$stmt->execute();