Problem Statement
Which of the following is the safest way to prevent SQL injection?
Explanation
Prepared statements separate SQL logic from user input. This prevents attackers from injecting malicious SQL through form inputs or URLs.
Code Solution
SolutionRead Only
$stmt = $pdo->prepare('SELECT * FROM users WHERE id = ?');Practice Sets
This question appears in the following practice sets:
