我有按以下格式提交數據的PHP形式選擇MySQL的日期範圍:如何使用PHP表單數據
Array (
[zone] => Array (
[0] => East
)
[publication] => Array (
[0] => ABP
)
[datefilter] => 09/01/2016 - 10/15/2016
)
我用數據來構建一個MySQL查詢,如下所示:
$zone_search = $_POST['zone'];
$zone = join("','",$zone_search);
$publication_search = $_POST['publication'];
$publication = join("','",$publication_search);
$tmp = "SELECT * FROM advertisement
WHERE zone IN('$zone')
AND publication IN('$publication')";
但是,我想將數據限制在$_POST['datefilter']
字段中給出的兩個日期。如何將日期過濾日期添加到我的查詢中?
在數據庫表中的相關列是:
zone
publication
release_date