PHP Classes
elePHPant
Icontem

PHP SQL builder class: Build and execute MySQL queries from parameters

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us
  Info   View files Documentation   View files View files (2)   DownloadInstall with Composer Download .zip   Reputation   Support forum   Blog    
Last Updated Ratings Unique User Downloads Download Rankings  
2014-06-22 (1 year ago) RSS 2.0 feedNot enough user ratingsTotal: 559 All time: 5,058 This week: 1,164Up
Version License PHP version Categories  
php-sql-builder 1.0GNU Lesser Genera...5PHP 5, Databases
Description Author  

This class can build and execute MySQL queries from parameters.

It can take parameters that define a table name, table fields, field values and condition clauses.

The class can assemble a SQL query of a given type (SELECT, INSERT, UPDATE and DELETE) and executes the query in a MySQL database.

Picture of Goran Jordanoski
Name: Goran Jordanoski <contact>
Classes: 1 package by
Country: Macedonia Macedonia
Age: 41
All time rank: 28723 in Macedonia Macedonia
Week rank: 1471 Up2 in Macedonia Macedonia Up

Details provided by the author  
This is simple class that I use to get user friendly insert/update SQL. 
Instead of 
INSERT INTO (field, field, field, field) VALUES(value, value, value value);

/*
Example:

$SQLbuilder = new SQLbuilder();
$SQLbuilder->setTableName('SQLbuilder');
$SQLbuilder->addField('creator_first_name', 'Goran');
$SQLbuilder->addField('creator_last_name', 'Jordanoski');
$SQLbuilder->addField('creator_email', 'berezitski@gmail.com');
$SQLbuilder->addField('creator_linkedin', 'http://www.linkedin.com/in/berezitski');
$SQLbuilder->addField('creator_occupation', 'outsourcing');
$SQLbuilder->addField('date_entered', 'NOW()', 'not_quoted');

$query = $SQLbuilder->getSQL();

 
  Files folder image Files  
File Role Description
Plain text file README.txt Doc. text file
Plain text file SQLbuilder.php Class Class file

 Version Control Unique User Downloads Download Rankings  
 0%Total:559All time:5,058
 This week:0This week:1,164Up