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);
2
Q
How does the dbo try catch block look?
A
Try { $dbh = new Dbo(....); } catch ($e) { die(“Could not connect”); }
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”; }