版本: v2.3.0
has
檢查資料表中是否存在符合條件的記錄。
has($table, $where)
table [string]
要查詢的資料表名稱。
where [array]
用於檢查符合條件記錄的 WHERE 條件。
has($table, $join, $where)
table [string]
要查詢的資料表名稱。
join [array]
用於關聯相關資料表的 JOIN 定義;如果不需要 JOIN,可省略此參數。
where [array]
用於檢查符合條件記錄的 WHERE 條件。
回傳值
[bool] 如果至少存在一筆符合條件的記錄,則回傳
true;否則回傳 false。$isAccount = $database->has("account", [
"AND" => [
"OR" => [
"user_name" => "foo",
"email" => "foo"
],
"password" => "12345"
]
]);
if ($isAccount) {
echo "密碼正確。";
} else {
echo "密碼無效。";
}