Method: db::select
Returns multiple rows from a table
Info
Syntax
db::select($table, $select='*', $where=null, $order=null, $page=null, $limit=null, $fetch=true)
Parameters
- $table (string) The table name
- $select (mixed) Either an array of fields or a MySQL string of fields
- $where (mixed) Either a key/value array as AND connected where clause or a simple MySQL where clause string
- $order (string) Order clause without the order keyword. ie: "added desc"
- $page (int) a page number
- $limit (int) a number for rows to return
- $fetch (boolean) true: apply db::fetch(), false: don't apply db::fetch()
Return (mixed)
Example
$users = db::select('users', '*');
// users is an array with all rows and all columns from the table 'users'
$posts = db::select('posts', 'id, title, body', array('user' => 1));
// posts is an array with all posts from user 1 and the specified columns
$comments = db::select('comments', array('id', 'text'), false, 'added DESC', 0,10);
// comments is an array with 10 comments sorted by comments_added