Lightweight MySQL adapter and SQL generator
Via Composer
composer require jbboehr/zsql
$database = new zsql\Adapter\MysqliAdapter($mysqli);
$database->delete()
->from('tableName')
->where('columnName', 'value')
->limit(1)
->query();
$database = new zsql\Adapter\MysqliAdapter($mysqli);
$id = $database->insert()
->ignore()
->into('tableName')
->value('columnName', 'value')
->value('otherColumnName', 'otherValue')
->query();
$database = new zsql\Adapter\MysqliAdapter($mysqli);
$rows = $database->select()
->from('tableName')
->where('columnName', 'value')
->order('orderColumn', 'ASC')
->limit(2)
->offset(5)
->query()
->fetchAll();
$database = new zsql\Adapter\MysqliAdapter($mysqli);
$database->update()
->table('tableName')
->set('columnName', 'value')
->set('someColumn', new zsql\Expression('NOW()'))
->where('otherColumnName', 'otherValue')
->limit(1)
->query();
See Adapters.md
make test
This project is licensed under the MIT license.