What are the drawbacks of using "LIKE" in password queries and how can it be improved?

Using "LIKE" in password queries can be insecure as it allows for partial matches, potentially exposing sensitive information. To improve this, it is recommended to use a more secure method such as prepared statements with parameterized queries to prevent SQL injection attacks.

// Using prepared statements with parameterized queries to securely query passwords
$stmt = $pdo->prepare("SELECT * FROM users WHERE username = :username AND password = :password");
$stmt->bindParam(':username', $username);
$stmt->bindParam(':password', $password);
$stmt->execute();