Database
  • Get started
    • Database for PHP
    • Install / configure
    • Quick reference
  • Dbi
    • Instance model
    • Instance configuration
    • Instance methods
    • Query examples
  • Dba
    • Query builder
    • Put Methods
    • Scope Methods
    • Return Methods
  • SQLI
    • Query execution
    • Request Methods
    • Query Methods
Powered by GitBook
On this page
  1. Get started

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);
PreviousInstall / configureNextInstance model

Last updated 2 years ago