版本: v2.6.0
get
從資料表中取得單筆記錄。
get($table, $columns, $where)
get($table, $join, $columns, $where)
回傳值
[mixed] 回傳首筆符合條件的記錄;如果只查詢單一欄位,則回傳純量值,否則回傳關聯陣列。
$email = $database->get("account", "email", [
"user_id" => 1234
]);
// 範例結果:
// "foo@bar.com"
$profile = $database->get("account", [
"email",
"gender",
"location"
], [
"user_id" => 1234
]);
// 範例結果:
// 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"
]);
// 範例結果:
// array(
// "content" => "A new day",
// "user_name" => "foo",
// "location" => "earth"
// )