我目前正在使用高级搜索从数据库中搜索记录。我也为此创建了脚本,我使用OR
运算符和BETWEEN
查询,但我对如何使用从最小到最大的请求率感到困惑。如何将AND
OR
运算符与BETWEEN
等MySQL搜索查询一起使用?
if ($result = mysqli_query($con, "SELECT * FROM meta WHERE title='$title' OR
discription='$discription' OR region='$region' OR city='$city' OR
sector='$sector' OR minimum='$minimum' OR mini='$mini' OR minni='$minni'"))
答案 0 :(得分:0)
OR('$ var'> minimum AND'$ var'< maximum)
答案 1 :(得分:0)
OR ('$var' BETWEEN minimum AND maximum)
答案 2 :(得分:0)
您可以在
之间使用从meta中选择*,其中title =' $ title'和(在&$ 39; $ start_date'和$ 39; $ end_date')之间的日期。
答案 3 :(得分:0)
SELECT * FROM meta WHERE
(
title='$title' OR
discription='$discription' OR region='$region' OR city='$city' OR
sector='$sector' OR minimum='$minimum' OR mini='$mini' OR minni='$minni'
) -- Atleast one of the above or conditions must be true
AND (date between '$start_date' and '$end_date');
OR
SELECT * FROM meta WHERE
(
title='$title' OR
discription='$discription' OR region='$region' OR city='$city' OR
sector='$sector' OR minimum='$minimum' OR mini='$mini' OR minni='$minni'
) -- Atleast one of the above or conditions must be true
AND (date > '$start_date' and date < '$end_date');