Working with PDO
In this section, we will be creating the PDO wrapper and using a database as a data source from our model.
From this section, we will gain the ability to use a database within our framework project.
Six methods will be covered here.
We have a
get method — this is for creating a connection to the database and making sure it is a singleton instance, meaning it can only ever have one instance:
- We have a
rawmethod for running raw, unsecured queries
selectmethod for running secure queries to select records from the database
insertmethod to create new records
updatemethod to update records
deletemethod to delete records
truncatemethod to empty a table
What this does is allow your CRUD to work. Without this class, CRUD functionality ...