Version: v2.4.0
get
Retrieve a single record from a table.
get($table, $columns, $where)
table [string]
The name of the table to query.
columns [string/array]
The column or columns to retrieve.
where [array] (optional)
The WHERE clause used to filter the result set.
get($table, $join, $columns, $where)
table [string]
The name of the table to query.
join [array]
The join definitions used to combine related tables. Omit this parameter if no joins are required.
columns [string/array]
The column or columns to retrieve.
where [array] (optional)
The WHERE clause used to filter the result set.
Return Value
[mixed] The first matching record as a scalar value or associative array.
$email = $database->get("account", "email", [
"user_id" => 1234
]);
// Example result:
// "foo@bar.com"
$profile = $database->get("account", [
"email",
"gender",
"location"
], [
"user_id" => 1234
]);
// Example result:
// 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"
]);
// Example result:
// array(
// "content" => "A new day",
// "user_name" => "foo",
// "location" => "earth"
// )