What is the difference between these two prepared
statements?
$stmt = $pdo->prepare(\'SELECT * FROM employees WHERE name = :name\');
$
The difference is below:-
Mysqli
is only for the MySQL database. PDO
supports other database using the same functions.
Mysqli
can be used in either an object-oriented style or a procedural style. PDO
is always object-oriented.
Mysqli
supports prepared statements with ?
placeholders for parameters. PDO
supports both ?
placeholders and also named placeholders, like :columnName
.
Mysqli
requires that you use a function to bind each parameter value to the prepared statement. PDO
also allows you to simply pass an array of parameter values as you execute the prepared statement.