เวอร์ชัน: v2.3.0
get
ดึงข้อมูลระเบียนเดียวจากตาราง
get($table, $columns, $where)
table [string]
ชื่อตารางที่ต้องการดึงข้อมูล
columns [string/array]
คอลัมน์ที่ต้องการดึงข้อมูล
where [array] (ไม่บังคับ)
เงื่อนไข WHERE สำหรับกรองผลลัพธ์
get($table, $join, $columns, $where)
table [string]
ชื่อตารางที่ต้องการดึงข้อมูล
join [array]
คำสั่ง JOIN สำหรับเชื่อมตารางที่เกี่ยวข้อง หากไม่ใช้ JOIN สามารถละพารามิเตอร์นี้ได้
columns [string/array]
คอลัมน์ที่ต้องการดึงข้อมูล
where [array] (ไม่บังคับ)
เงื่อนไข WHERE สำหรับกรองผลลัพธ์
ค่าที่ส่งกลับ
[mixed] ข้อมูลรายการแรกที่ตรงกัน โดยอาจเป็นค่าสเกลาร์หรือ associative array
$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"
// )