nerdexam
Zend

200-710 · Question #117

What is the preferred method for preventing SQL injection?

The correct answer is A. Always using prepared statements for all SQL queries. See the full explanation below for the reasoning.

Security

Question

What is the preferred method for preventing SQL injection?

Options

  • AAlways using prepared statements for all SQL queries.
  • BAlways using the available database-specific escaping functionality on all variables prior to building the SQL query.
  • CUsing addslashes() to escape variables to be used in a query.
  • DUsing htmlspecialchars() and the available database-specific escaping functionality to escape variables to be used in a query.

How the community answered

(41 responses)
  • A
    78% (32)
  • B
    5% (2)
  • C
    12% (5)
  • D
    5% (2)

Topics

#SQL injection#prepared statements#parameterized queries#input sanitization

Community Discussion

No community discussion yet for this question.

Full 200-710 Practice