version: 2.2.0
get
Get only one record from the table.
get($table, $columns, $where)
table [string]
The table name.
columns [string/array]
The target columns of data will be fetch.
where (optional) [array]
The WHERE clause to filter records.
get($table, $join, $columns, $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: [string/array/int/object] Return the data of the column.
$email = $database->get("account", "email", [
"user_id" => 1234
]);
// $email = "foo@bar.com"
$profile = $database->get("account", [
"email",
"gender",
"location"
], [
"user_id" => 1234
]);
// $profile = array(
// "email" => "foo@bar.com",
// "gender" => "female",
// "location" => "earth"
// )
$data = $database->get("post", [
"[>]account" => "user_id"
], [
"post.content",
"account.user_name",
"account.location"
], [
"ORDER" => "post.rate"
]);
// $data = array(
// "content" => "A new day",
// "user_name" => "foo",
// "location" => "earth"
// )