version: 2.2.0
rand
Fetch data from the table randomly.
rand($table, $column, $where)
table [string]
The table name.
columns [string/array]
The target columns of data will be fetched.
where (optional) [array]
The WHERE clause to filter records.
rand($table, $join, $column, $where)
table [string]
The table name.
join [array]
Table relativity for tables. Ignore it if no table joining is required.
columns [string/array]
The target columns of data will be fetched.
where (optional) [array]
The WHERE clause to filter records.
Return: [array] Random data from the table.
- $data = $database->rand("account", [
- "user_name",
- "email"
- ], [
- "user_id[>]" => 100
- ]);
- // $data = array(
- // [0] => array(
- // "user_name" => "foo",
- // "email" => "foo@medoo.in"
- // ),
- // [1] => array(
- // "user_name" => "cat",
- // "email" => "cat@medoo.in"
- // )
- // )