1. Go to this page and download the library: Download amadiify/querydb library. Choose the download type require.
2. Extract the ZIP file and open the index.php.
3. Add this code to the index.php.
<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
// generic option
Client::table('user')->get();
// or
Client::user()->get();
// or
\user::get(); // some other configuration must be made for this to work.
// using generic
Client::table('user')->get('userid=?', 1);
// or
Client::table('user')->get('userid=?')->bind(1);
// or
Client::table('user')->get('username,password')->where('userid=?')->bind(1);
// we can even perform two actions at the same time
Client::table('user')->get('userid=?')->bind(1)->update(['username' => 'frank']);
// get random
Client::table('user')->get()->rand();
// using limit
Client::table('user')->get()->limit(0,20);
// using order
Client::table('user')->get()->orderby('username', 'asc')->limit(0,20);
// and much more.
// see the cheat sheet for more possibilities.
// lets insert something simple
$table = Client::table('user');
// simple first
$table->insert(['username' => 'chris']);
// multiple
$table->insert(['username' => 'mack'], ['username' => 'frank']); // and much more
// if you drop the line you need to instruct execution
$table->insert(
['username' => 'mack'],
['username' => 'sam']
)->go();
// or
$table->insert('username,password')->bind('mack', '1234');
// or
$table->insert('username,password', 'mack', '1234');
// or run a get after
$table->insert('username,password')->bind('mack', '1234')->get(); // returns records.
$data = [
[
'username' => 'Moorexa',
'password' => 'hash-password'
],
[
'username' => 'Wekiwork',
'password' => 'hash-password'
]
];
array_map(function($data){
Client::table('user')->insert($data);
}, $data);
// insert json data
$table->insert('{"username":"mike2", "password":"hash-password2"}');
// or insert an object
$object = (object) $data;
$table->insert($object);
// and much more..
// get table
$table = Client::table('user');
// update with json
$table->update('{"username":"chris", "id":3}', 'userid=?', 3);
// or
$table->update('{"username":"chris", "id":3}')->where('userid=?', 3);
// or
$table->update('{"username":"chris", "id":3}')->where('userid=?', 3);
// or
$table->update(['username' => 'chris'], 'userid = ?', 3);
// or
$table->update(['username' => 'moorexa'])->where('userid = ?')->bind(3);
// or
$get = $table->get('username = ?')->bind('chris');
// then update that row
$get->update(['telephone' => '080000000000']);
// and much more
// get table
$table = Client::table('user');
// update with json
$table->delete('userid = ?')->bind(30);
// or
$table->delete(['userid' => 3]);
// or
$get = $table->get('userid = ?', 2);
// then delete that row
$get->pop();
// and much more
Client::sql('select * from users where username = ?', 'chris');
// or
Client::sql('select * from users where username = :name')->bind('chris');
// or
Client::sql('select * from users where username = "chris"');
// interpreted as
// select * from users where username = :username
// or
$table = new Client();
$table->sql('Your query here.');
$default = Client::serve();
$switch1 = Client::apply('database1');
// and other queries can be chained here
Loading please wait ...
Before you can download the PHP files, the dependencies should be resolved. This can take some minutes. Please be patient.