PHP Classes

MySQLWrapper: Execute MySQL database queries programmatically

Recommend this page to a friend!
  Info   View files View files (5)   DownloadInstall with Composer Download .zip   Reputation   Support forum   Blog    
Ratings Unique User Downloads Download Rankings
StarStarStar 41%Total: 325 All time: 7,193 This week: 206Up
Version License PHP version Categories
mysqlwrapper 1.0Freeware5.0PHP 5, Databases


This package is a MySQL database access wrapper that can be used to execute SQL queries programmatically.

It has base classes to manage the database connection and query execution and also a class to execute SQL queries from lists of parameters.

The class can execute queries to:

- Count rows in a given table
- Retrieve all rows from a table that match a condition
- Retrieve all values of a table field that match a condition
- Insert table records from an array or parameters
- Create a table from an array of parameters
- Update rows of a table that match a condition with values from a parameter array
- Delete rows from a table that match a condition

Picture of Gurdeep Singh
Name: Gurdeep Singh <contact>
Classes: 5 packages by
Country: India India
Age: ???
All time rank: 38622 in India India
Week rank: 271 Up21 in India India Up
Innovation award
Innovation award
Nominee: 1x


README I am having more than 6 years of experience in coding and project management. I started my career with PHP and presently I am in Java, J2EE. I have a good proficiency in Web-Services, Struts, Database, PHP, Linux. You can contact me on for any type of help. I always support OOPs based programming. This helps us to make our code robust and understandable. I also practice Design patterns in my programming. I am contributing PHP classes to this site. class helped me a lot when I was fresher, so I thanks to PHPClasses and I am contributing to this site. MySQLWrapper: We perform Database operation on almost every application. So in order to perform this operation, we have to open-->maintain-->use-->close database connection every time. Sometimes we also need to know the time taken for query to execute. In this class (MySQLWrapper) I tried to add a wrapper on MySQL database. This will save our time from writing all the MySQL stuff over and again in the application, this will save our time, resources and will make ceteralized dabase section. I have also used the PHPLogger (one of my earlier contributions) to log queries and time taken by the queries. I have added following Files in this package: 1. DatabaseInformation.php - This class included all the information required to connect to the database. 2. DatabaseManager.php - This is the low level class. It checks for the connection and returns the connection if unavailable. - This class defines executeQuery and executeUpdate methods, which actuall executes the query. - This class use PHPLogger class to log the message. - this class can create database - This class have the method define to check if table or column in table exists. - This class have the method to select database. - This class have the method to close connection 3. QueryManager.php - This class uses methods from DatabaseManager class and do the following: - This class returns the count rows from the table. - This class executes query provided. - This class executes the query based on the condition. - This class update the table data. - This class delete/truncate the table data. - This class creates the table. 4. queryManagerTest.php - This php file tells us the way to use the methods defined in QueryManager.php 5. userLogin.php - This is the simple Login screen. It picks the username/password entered by the user. - Passes the username/password to UserManager class - UserManager class then uses QueryManager class to execute the required queries. As such you can know the class execution way with simple queryManagerTest.php file. But still if you want to use my Login application to test it, then please change the path as per your requirement. or you can keep database related files (DatabaseInformation.php, DatabaseManager.php and QueryManager.php) files in package called MySQLWrapper. User related file (UserManager.php) in package called UserAction. and please keep userLogin.php and general.css outside these packages or as per your requirements. Please also include Logger package from PHPLogger to log the application messages. Though I do not commit anything but please suggest any improvements on

  Files folder image Files  
File Role Description
Plain text file DatabaseInformation.php Class Contains the basic information about database, like username, database name, password
Plain text file DatabaseManager.php Class This class is a layer above MySQL and take care to connect to database and perform required task and close connection.
Plain text file QueryManager.php Class A Layer above DatabaseManager. This class perform Select, Update, Delete queries on database.
Accessible without login Plain text file queryManagerTest.php Example Simple file to show, how we can use methods from QueryManager.php
Accessible without login Plain text file Readme.txt Doc. Describes the usage of QueryManager 7KB
Install with ComposerInstall with Composer
Needed packages  
Class DownloadWhy it is needed Dependency
PHPLogger Download .zip .tar.gz This is required to log error/debug/warning message Required
 Version Control Unique User Downloads Download Rankings  
This week:0
All time:7,193
This week:206Up
 User Ratings  
 All time