Complete the code to prepare a SQL statement using PDO.
$stmt = $pdo->[1]("SELECT * FROM users WHERE id = :id");
The prepare method is used to prepare a SQL statement for execution with bound parameters.
Complete the code to bind the parameter ':id' as an integer.
$stmt->bindParam(':id', $id, [1]);
Use PDO::PARAM_INT to bind an integer parameter.
Fix the error in binding a parameter by completing the code.
$stmt->[1](':name', $name);
bindParam binds a variable by reference, which is needed here.
Fill both blanks to bind ':age' as an integer and execute the statement.
$stmt->[1](':age', $age, [2]); $stmt->execute();
Use bindParam with PDO::PARAM_INT to bind an integer parameter by reference.
Fill all three blanks to prepare a statement, bind ':email' as string, and execute.
$stmt = $pdo->[1]("SELECT * FROM users WHERE email = :email"); $stmt->[2](':email', $email, [3]); $stmt->execute();
First prepare the statement, then bind the ':email' parameter as a string using bindParam and PDO::PARAM_STR, then execute.
