1. 程式人生 > >PHP MySQL 查詢 指定 範圍 日期 時間段 資料 between 用法

PHP MySQL 查詢 指定 範圍 日期 時間段 資料 between 用法

下面是時間戳查詢如果你資料庫時間顯示的是 2011-04-05 那就不需要 用 strtotime 時間戳轉換函式:

$timea = strtotime($_POST['timea']);
$timeb = strtotime($_POST['timeb']);
$sq2="select * from `ecs_order_info` where add_time between '$timea' and '$timeb' and `quanxian`='$dangqian' order by `order_id` DESC limit 50";
$sql = mysql_query($sq2);