我有 3 种不同类型的查询来检索同一页面中的数据。我将如何完全结合?以下是查询:
<?php
$sql = "SELECT * FROM general WHERE ((day1sql >= now()))";
if($_GET!=""){
$mydate = mysql_real_escape_string($_GET['datepicker']);
if($mydate!=""){
$sql = "SELECT * FROM general WHERE ((day1 = '$mydate'))";
}
}
if($_GET!=""){
$city1 = mysql_real_escape_string($_GET['cityText']);
if($city1!=""){
$sql = "SELECT * FROM general WHERE (city = $city1))";
}
}
datepicker 是一个日历,用户可以根据日期获取数据。并且有一个下拉菜单,用户可以选择城市名称。前两个查询工作正常。我很困惑如何整合第三个查询?