Skip to content

Latest commit

 

History

History
44 lines (28 loc) · 940 Bytes

database.md

File metadata and controls

44 lines (28 loc) · 940 Bytes

Basic Database Usage

Configuration

The database configuration file is app/config/database.php where you can define the connection details, as well as some other options.

Running Queries

You can run queries using the DB class.

Running A Select Query
$users = DB::select('select * from users where id = ?', array(1));

The select method will always return an array of results.

Running An Insert Statement
DB::insert('insert into users (id, email) values (?, ?)', array(1, '[email protected]'));
Running An Update Statement
DB::update('update users set email = "[email protected]" where id = ? limit 1', array(1));
Running A Delete Statement
DB::delete('delete from users where id = ?', array(1));
Running A General Statement
DB::statement('drop table users');