Chapter 2. Build a Database Class and Simple Shopping Cart
For our previous app, which was just user profiles, we only created a simple Create-Read-Update-Delete (CRUD) database abstraction layer - basic stuff. In this chapter, we will create a better database abstraction layer that will allow us to do more than just basic database functions.
Aside from the simple CRUD features, we will add result manipulation into the mix. We'll build the following features into our database abstraction class:
- Conversion of integers to other, more accurate numeric types
- Array to object conversion
firstOf()
method: Allows us to select the first of the results of a database querylastOf()
method: Allows us to select the last of the results of a database queryiterate() ...
Get PHP 7 Programming Blueprints now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.