PhpRiot
News Archive
PhpRiot Newsletter
Your Email Address:

More information

PHPEasy.co.uk: Object Orientation Basics part 4 - Implementing CRUD methods

Note: This article was originally published at PHPDeveloper on 8 August 2012.
PHPDeveloper

PHPEasy.co.uk continues their series looking at some of the basics of Object-Oriented Programming (OOP) in PHP with part four showing how to implement CRUD methods (Create/Read/Update/Delete) on a database connection.

In the last tutorial in this beginners series we discussed using PDO to connect to a MySQL database. Following on from that tutorial we are going to improve the Guitar class we made by adding some basic CRUD methods so that our class can interact with our database using PDO.

He brings back the same class structure and shows how to take a "Guitar" object, create a connection via a "conn()" method and use the getters/setters to assign values for saving, selecting, deleting and updating the database's records.