Download presentation
Presentation is loading. Please wait.
Published byAdi Hadiman Modified over 6 years ago
1
PDO Revisited MIS 3502 Jeremy Shafer Department of MIS
Fox School of Business Temple University
2
Roadmap We are here.
3
Agenda Old business New business
Review code which opens a PDO database connection Review the PDO methods – prepare, bindvalue, execute, fetch, fetchAll, closecursor Review sample code which executes SELECT, INSERT, UPDATE and DELETE statements New business A tip for managing errors An alternative to named placeholders The lastInsertId method
4
Opening a database connection
The syntax for executing a method of any object $objectName->methodName(argumentList) What’s the meaning of this?
6
What’s the purpose of this line?
Tip! What’s the purpose of this line?
8
Remember the order: prepare bindValue Execute
9
Using the question mark placeholder instead of a named placeholder.
Tip! Using the question mark placeholder instead of a named placeholder.
10
Retrieves one database record as a one dimensional array.
SELECT Retrieves one database record as a one dimensional array. Remember the order: prepare bindValue execute fetch closeCursor
12
Retrieves multiple database records as a two dimensional array.
Remember the order: prepare bindValue execute fetchAll closeCursor
13
Can be hard to read…
14
Slightly easier to read…
15
INSERT Tip!
16
UPDATE
17
DELETE
18
Let’s see what we can build…
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.