Quick reference

Where Sqli() accepts an SQL statement as a variable, Dba() allows you to build a query programatically using chained methods. The following queries would return the same results.

$sqli = new Sqli();
$sqli->list( 'SELECT * FROM users' );

$db = new Dba();
$db->table('users')->list();

The shorthand database instance Dbi() can be used as a static function like this:

Dbi::table('users')->list();

Extend your object models on Dbi().

class User extends Dbi {

    public static $table = 'users';

}

$user = User::row(2);

Last updated