The prepare() method prepares an SQL statement for execution and returns a statement object. Its
primary job is to separate the SQL logic from the actual data. Instead of injecting direct values into the command,
we use named parameters (e.g., :id). This allows the database to pre-analyze and optimize the query
while completely blocking SQL injection attacks, as data is treated separately from the executable command.
Practical Application: We always use the prepare method whenever an SQL statement
contains data entered by a user (e.g., search, login, or profile editing). Check the process at home by following
these steps:
users table exists within the pdo_db database.PDOStatement object, which you then execute using the
execute() method.