This small class will save you time by providing CRUD methods for quickly building SQL query statements. This can be used and integrated into any existing project with ease. Also, it is great at handling exceptions when SQL errors are produced.
System Requirements
- PHP 5
- PDO Extension
- Supported PDO Driver(s) – PDO_SQLITE, PDO_MYSQL, PDO_PGSQL
Usage
require('class.db.php'); // Create $bind = array( ":id" => $_POST['user_id'], ":user" => $_POST['username']); db::inst()->insert( "users", array(":id", ":user"), 'user_id, username', $bind ); // Read db::inst()->init( "SELECT * FROM users ORDER BY last_name" ); // Update $bind = array( ":signature" => $_POST['signature'] ); db::inst()->update( 'users', array('signature' => ":signature"), array('username',$_SESSION['username']), $bind ); // Delete $bind = array(":id" => $_POST['pID']); db::inst()->delete( "posts", "postID = :id", $bind );
Changelog
-
(08.07.2013) v1.1
- Emulation set to false for true PDO
- Fixed issue when error reporting set to E_ALL
- Added DSN_PREFIX instead of hardcoding the prefix for more flexibility
- No need to double quote bind parameters anymore
- Updated for PHP 5.4.x
- Fixed query method to use bind parameters when not false
- Updated documentation to reflect changes
[eltd_button size=”huge-full-width” type=”outline” text=”Download & Demo Links” custom_class=”#” icon_pack=”font_awesome” fa_icon=”” link=”” target=”_blank” color=”” hover_color=”” background_color=”” hover_background_color=”” border_color=”” hover_border_color=”” font_size=”” font_weight=”” margin=””]
Demo = PDO CRUD Class
[eltd_button size=”huge” type=”” text=”Full Live Demo” custom_class=”” icon_pack=”font_awesome” fa_icon=”fa-laptop” link=”https://codecanyon.net/item/pdo-crud-class/3543667″ target=”_blank” color=”” hover_color=”” background_color=”” hover_background_color=”” border_color=”” hover_border_color=”” font_size=”” font_weight=”” margin=””]
Kindly Note: We update new contents like WordPress Themes, Plugins, PHP Scripts everyday. But remember that you should never use this items in a commercial website. All the contents posted here for development & testing purpose only. We’re not responsible for any damage, use at your own RISK! We highly recommend to buy PDO CRUD Class from the The Developer ( parkerj ) website. Thank you.
Download = PDO CRUD Class-[Updated].zip