php根據輸入開始時間 結束時間搜尋訂單資料
資料庫表名是dede_shops_orders,時間欄位是stime(int類型)已經轉化為時間資料顯示了:;控制項已做好,想根據倆個input的時間資料進行搜尋,PHP頁面如何處理啊,求大神指點!
------解決思路----------------------
select的時候where區間查詢,> 和<
------解決思路----------------------
shops_operations.php頁面根據傳過來的 起始時間 $startTime 和結束時間 $endTime寫出sql
select * from dede_shops_orders where `stime` between $startTime and $endTime.
要先把 起始時間和結束時間也轉化成整型
------解決思路----------------------
引用:
Quote: 引用:
Quote: 引用:
shops_operations.php頁面根據傳過來的 起始時間 $startTime 和結束時間 $endTime寫出sql
select * from dede_shops_orders where `stime` between $startTime and $endTime.
要先把 起始時間和結束時間也轉化成整型
//訂單時間查詢
$t1=$_POST['starttime'];//開始時間
$t2=$_POST['endtime'];//結束時間
//var_dump($t1);
//die;
$sql="select * from dede_shops_orders where `stime` between $startTime and $endTime.";
$result=mysql_query($sql);
while($row=mysql_fetch_row($result)){
echo $row[0].' '.$row[1].'
';
}
現在改成這樣了 這個stime資料庫是140551515 是用函數做過處理的。。。接下來要怎麼改啊
$sql="select * from dede_shops_orders where `stime` between $t1and $t2.
這個已經是按起始時間和結束時間搜尋出結果了啊
------解決思路----------------------
你列印下 $t1 $t2 還有資料庫裡面存的stime欄位都是什麼樣的?
------解決思路----------------------
。。。 哦 看出問題了 你的 form表單是get方式提交。 你擷取值的時候用的是$_POST ,肯定擷取不到值啊
------解決思路----------------------
method="get" 改為 method="post"
------解決思路----------------------
比例的時候要用一樣的格式。既然你資料庫裡時間存的是int,那時間條件也轉換成int去比較。