Final Study Flashcards

1
Q

What does the syntax of a prepared statement look like?

A

$id = filter_input(INPUT_POST, “id”, FILTER_SANITIZE_SPECIAL_CHARS); $command=”DELETE FROM polls WHERE ID=?”;
$stmt = $dbh->prepare($command);
$userParams = [$deleteid];
$stmt->execute($userParams);

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

How does the dbo try catch block look?

A
Try {
$dbh = new Dbo(....);
} catch ($e) {
    die(“Could not connect”);
}
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

How do you check if a prepared statement was properly executed or not?

A
If (!execute([$1, $2, $3...]){
      Echo “error not executed”;
} else {
      Echo “execution successful”;
}
How well did you know this?
1
Not at all
2
3
4
5
Perfectly