2014-02-19 105 views
0

我有一些代碼,下面的查詢......減去時間的方法一天PHP

$student_result = db_query("select id,timestamp,time_id,unschedule_code from student where canceled='0' and email='".$email."' and timestamp > '".time()."'"); 

我想改變和時間戳>「」。時間()。「'」);時間 - 第1天我tryed像...

$student_result = db_query("select id,timestamp,time_id,unschedule_code from student where canceled='0' and email='".$email."' and timestamp > '".time(). - 1"'"); 

...沒有運氣頁根本無法加載,所以我敢肯定,語法甚至沒有任何有效的幫助表示讚賞...

回答

2

時間戳以秒爲單位,請嘗試:

$student_result = db_query("select id,timestamp,time_id,unschedule_code from student where canceled='0' and email='".$email."' and timestamp > '".(time()-(3600*24))."'"); 
+0

熱潮!你釘了兄弟。好決定。 – Lumbee