// initiate the main DB class
$db = new DB('mysql://user:pass@server/db');
$users = $db->table('users'); $users->find(); // returns an array of all records from the users table
$users->find_by_name('test'); // returns any rows where the name field == test
$users->find_by_name_like('%test%'); // returns any rows where the name field LIKE '%test%'
$users->create( 'name' => 'test', 'email' => 'test@test.com', 'enabled' => 1 ); // creates a new row in the users table with the specified data
$id = $users->lastId(); // return the last insert id
$user = $users->find($id); // find a user where id == $id
$user->name = 'not test'; // set the name to not test
$user->save(); // save the record
$posts = $db->table('posts'); $posts->find_by_date_after(date('Y-m-d H:i:s', strtotime('yesterday'))); // find all posts from the past 24 hours
$posts->find_by_title_like('%php', array('order' => 'date DESC', 'limit' => 1));
$posts->find_by_user_id_and_title_like(array(12, '%php%')); // find all posts by a certain user with title LIKE '%php%'