The query() method executes an SQL statement in a single step and returns the result set as a
PDOStatement object. Unlike the prepare() method, queries here are not pre-compiled,
making it ideal for simple SELECT commands that contain no user-supplied data (e.g., listing categories
or system settings). It is faster and requires shorter syntax since it bypasses a separate call to the
execute() method.
Practical Application: Use the query method only when the SQL statement is
predetermined and safe from outside manipulation. Check the process at home by following these steps:
users table exists and contains data within the
pdo_db database.foreach
loop.