Simplified DB - PDO, Mysqli and Mysql helper class

Simplified DB is a PHP database abstraction class that helps developer perform MySQL operations easily using PDO, Mysqli and Mysql. Using Simplified DB, you can easily create and run both simple and advanced database driven application in PHP without having any knowledge of SQL.

Simplified DB provide a single solution for all you need to perform CRUD operation on Mysql DB using PHP as it covers all the 3 major ways (PDO, Mysqli and Mysql) of doing it. It has various shorthand methods that reduce code lines, improve readability of your code, improve security, performance & simplify your database operations.

Simplified DB project contains three separate files for the PDO, Mysqli and Mysql that helps developer to perform Mysql CRUD operations using either PDO or Mysqli or Mysql, without any knowledge of queries. Simplified DB project contains 3 files, SimplifiedDBPDO.php for PDO, SimplifiedDBMysqli.php for Mysqli and SimplifiedDBMysql for Mysql, though there are 3 separate file for PDO,Mysqli and Mysql but it provides same function definition for performing CRUD operation for PDO, Mysqli and Mysql. This enables you to use any extension PDO,Mysqli or Mysql and you can switch from one extension like upgrading from Mysql to PDO or Mysqli to PDO easily and also helps to remember less function definitions.

Features :
- Simple insert, update and delete,select operations for Mysql DB.
- Use either PDO or Mysqli or Mysql for insert, update, delete, select operations.
- Insert batch operations.
- Best practices, uses prepared statement for PDO and Mysqli
- Join, group by, order by, limit, between, in, not in etc. supported
- Debug easily with last generated query, error_info, message,rows_affected etc. information
- Same function names for each of PDO, Mysql and Mysqli, easy to remember and use
- Well documented and demo folder with sample code and sample database with each operation performed
- Helper functions for generating html forms directly from table, get html table display directly from select operation result

Quick Example of performing select operation

Traditional way of doing it using Mysql (Original Mysql api)

 
                 	<?php
                    /*** mysql hostname ***/
                    $hostname = 'localhost';
                    
                    /*** mysql username ***/
                    $username = 'username';
                    
                    /*** mysql password ***/
                    $password = 'password';
                    
                    /*** connect to server database ***/
                    $conn = mysql_connect($hostname,$username,$password);
                    
                    /*** check connection ***/
                    if(!$conn)
                    {
                        echo "Connecting problem";
                        die();
                    }
                    
                    /*** select database ***/
                    mysql_select_db("database",$conn);
                    
                    /*** select query ***/
                    $sql="SELECT first_name,last_name FROM users WHERE user_id=10";
                    
                    /*** execute the select query & get result ***/
                    $result=mysql_query($this->query);	
                 

                 

Using Simplified DB for Mysql

This is how you will do using the SimplifiedDB Class with Mysql(include SimplifiedDBMysql.php)

                   
                  	<?php                      
	                    /**** include SimplifiedDBMysql.php for mysql extension ****/
                        include("SimplifiedDBMysql.php");
                        
                        /**** create object of SimplifiedDB class ****/
                        $sdb= new SimplifiedDB();
                        
                        /**** connect to database ****/                
                        $sdb->dbConnect("localhost","username","password","dbuser"); 
                        
                        /**** run select operation and get result (one line code to perform select operation) ****/                
                        $result = $sdb->dbSelect("users",array("first_name","last_name"),array("user_id"=>10));
                
               	   ?>
                  

Using Simplified DB for Mysqli

This is how you will do using the SimplifiedDB Class with Mysqli (include SimplifiedDBMysqli.php)

                   
                  	<?php                      
	                    /**** include SimplifiedDBMysqli.php for mysqli extension ****/
                        include("SimplifiedDBMysqli.php");
                        
                        /**** create object of SimplifiedDB class ****/
                        $sdb= new SimplifiedDB();
                        
                        /**** connect to database ****/                
                        $sdb->dbConnect("localhost","username","password","dbuser"); 
                        
                        /**** Mysqli require one extra step, parameter binding ****/                
                        $sdb->parameter_types="i";
                        
                        /**** run select operation and get result (one line code to perform select operation) ****/                
                        $result = $sdb->dbSelect("users",array("first_name","last_name"),array("user_id"=>10));
                
               	   ?>
                  

Using Simplified DB for PDO

This is how you will do using the SimplifiedDB Class with PDO (include SimplifiedDBPDO.php)

                   
                  	<?php                      
	                    /**** include SimplifiedDBPDO.php for pdo extension ****/
                        include("SimplifiedDBPDO.php");
                        
                        /**** create object of SimplifiedDB class ****/
                        $sdb= new SimplifiedDB();
                        
                        /**** connect to database ****/                
                        $sdb->dbConnect("localhost","username","password","dbuser"); 
                        
                        /**** run select operation and get result (one line code to perform select operation) ****/                
                        $result = $sdb->dbSelect("users",array("first_name","last_name"),array("user_id"=>10));
                
               	   ?>