1. Which of the following is the safest way to prevent SQL injection?
Prepared statements separate SQL logic from user input. This prevents attackers from injecting malicious SQL through form inputs or URLs.
$stmt = $pdo->prepare('SELECT * FROM users WHERE id = ?');