PDO or PHP Data Objects is a very powerful yet lightweight API for accessing database in MySQL. If you are using PHP 5.1.0 or above it comes pre-installed. So if you are one of the guys still using the old mysql_query and related functions, this is the right time to upgrade. Using this mini project you can learn how to create a simple address book with PHP and MySQL using PDO classes.View Demo
Why should you use pdo?
Well, most of my friends asked me why should we use PDO as the older one (mysql_query and all) are far more easier to use and does the job perfectly. Yes, I do agree with their statement that the older one does the job perfectly but let’s get to a situation where you have an application running in php and mysql and after some time say 5 years, you want to change your database to Oracle or MS-SQL Server or any other. “Are you kidding me???” will say your old API, since you have coded specifically for mysql, so you have to change you codes all over and that will hurt your ar** badly.
To help you avoid these situations comes PDO. All you have to do is change the database driver and some queries and you are done. PDO has prepared statements which escapes user input variables that to most extent prevents sql injection. Since I love Object Oriented programming from the days I used to code in Java. This is what every object-oriented programming lover want.
So don’t just sit and think too much, from my experience I can personally gaurantee you once you learn PDO you will never think coding with the older API ever. You can find some more awesome tutorials fom PHP.net and tutplus for very basic stuffs. If you are a novice and starting php for the first time then I would strongly recommend you to learn php basics first. You can get some good basic tutorials in PHP for beginners section.
Just to let you know that the old mysql_query and related function are being deprecated, so you have other way now either learn PDO or mysqli (Mysql improved).
What are the features available in this address book project?
I have tried to make it as simple as possible yet covering all the basic features in simple address book.
- Made with Bootstrap. Design is responsive to devices like smart phones, tablets etc.
- Create, Update, View, Delete contacts (CRUD)
- Jquery validations for input fields.
- UTF-8 encoding used, so you can store contacts in different languages (multilingual).
- User can search for contacts (filtering).
- Pagination for viewing large contacts.