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
  • table( string $name | array )
  • set( array $columns )
  • where( array $conditions )
  • insert()
  • replace()
  • update()
  • updateById()
  • delete()
  1. Dba

Put Methods

Persist or remove data using these methods.

PreviousQuery builderNextScope Methods

Last updated 12 months ago

  • where(array)

  • orWhere(array)

  • insert(array)

  • replace(array)

  • update(array)

  • delete()

  • softDelete()

$db = new Dba();

table( string $name | array )

Set the name of the table to query.

$db->table('users');

Include a table alias using an array.

$db->table(['u' => 'users']);

set( array $columns )

Define the columns and values to insert() or update().

$db->set(['firstName' => 'Bill']);

where( array $conditions )

Define the conditions for the queries update() and delete().


insert()

Insert an entry into the database.

$user = $db->set(['firstName' => 'Trevor', 'lastName' => 'Smith'])->insert();
Query
INSERT INTO users SET firstName='Trevor', lastName='Smith';

Method alias: create()

replace()

update()

updateById()

delete()

table(string | array)
set(array)