You know the story: writing SQL queries is so boring. Especially when you don’t have time to do it. If you feel like me, today we are going to see something really cool: Fluent PDO. If the term “PDO” sounds new to you, don’t worry. It’s a really simple concept: in the PHP world PDO stands for Persistent Data Object and it helps you abstract some basic database-related operations (like inserts, updates, deletes etc.). It’s a layer between you and the database.
The result? No more SQL queries. Maybe this is not the first one you have seen: there are many similar projects out there and every single one has its key features. Fluent’s key feature is a great JOIN Query Builder.
Our Test Project
First of all, we will need a sample project to work with. Let’s think… what about a simple multi-user wishlist?
There are going to be many users, and each will have favorite products. For every user we will store the first name, last name and the signup date. For every item we will store the name, brand, price and the related user id.
I am going to use a simple MySQL database. Here’s the structure for our data:
… and here’s the SQL dump (with some dummy data).
Continue reading %Getting Started with FluentPDO%
more
{ 0 comments... » Getting Started with FluentPDO read them below or add one }
Post a Comment