What are the potential pitfalls of not using bindParam in PHP queries?

Using bindParam in PHP queries helps prevent SQL injection attacks by securely binding parameters to the query. Not using bindParam leaves the query vulnerable to malicious input that can manipulate the query and potentially access or modify sensitive data in the database.

// Example of using bindParam to securely bind parameters in a PHP query
$stmt = $pdo->prepare("SELECT * FROM users WHERE username = :username");
$stmt->bindParam(':username', $username);
$stmt->execute();