mediasoft.test

Connection:

$db = new QueryBuilder(); 		// with default settings

or

$conf = array(
  	'type'      => 'mysql',			// pgsql, mssql, sqlite
	'host'      => 'localhost',
	'user'      => 'root',
	'pass'      => 'pass',
	'db'        => 'test'
	);
	
$db = new QueryBuilder($conf);	// with some of the default settings overwritten

Build SQL-request

Select:

$db->select()
	->from('user')
	->where('age','>',10)
	->where('age','IS NOT NULL')
	->where('name','like','%ivan%','or')
	->in('name',array('Test',' name'))
	->not_in('age',array(16,20,17), 'OR')
	->between('age',14,50)
	->groupby(array('name','age'))
	->orderby('age')
	->limit(5)
	->offset(0,3);

Insert:

$db->insert('user', array('name'=>'Ivan', 'age'=>'20'));

Update

$db->update('user',array('name'	=> 'Ivan'))
	->where('age','>',60);

Delete

$db->delete('user')
	->where('age','>',50);

Execute

$db->save();

or

$db->save(PDO::FETCH_NUM));