2013-12-10 59 views
-1

我怎样才能让MySQL记录发送比从HTML中的GET变种像1386632264时间戳更大? (PHP和MySQL)MySQL和HTML时间戳

MySQL的时间戳是current_time_stamp

WHERE time>1386632264 

不工作

下面是该查询

select ua.user_id as member, ua.post_id, pa.user_id, pa.type, 
    pa.time, CONCAT(u.first_name,' ',u.last_name) as name,u.thumbnail 
from user_activity ua 
right join post_activity pa on ua.post_id=pa.post_id 
right join users u on pa.user_id=u.user_id 
where ua.user_id=6 and time<1386632264 
+0

是什么类型的字段'time'? – BenM

+1

MySQL的时间戳 – user3038421

+0

写代码,你试过吗? –

回答

1

获得MySQL timestampUNIX_TIMESTAMP。以下是查询。

select ua.user_id as member,ua.post_id,pa.user_id,pa.type,pa.time,CONCAT(u.first_name,' ',u.last_name) as name,u.thumbnail from user_activity ua right join post_activity pa on ua.post_id=pa.post_id right join users u on pa.user_id=u.user_id where ua.user_id=6 and UNIX_TIMESTAMP(time)<1386632264 
0

使用UNIX_TIMESTAMP,例如:

[your select instructions] WHERE UNIX_TIMESTAMP(time) >='1196440219' 

[your select instructions] WHERE time >= UNIX_TIMESTAMP([your webpage date time]) 

这是一个例子,用于比较的价值取决于你从网页中采取什么样的。

+0

不工作...我怎么可以转换时间戳像2013年12月10日10时23分04秒 到13456752786? – user3038421

+0

更新后,我误解了你的问题,对不起。 – Matteo