Mysql和html时间戳

时间:2013-12-10 10:56:29

标签: php mysql

我怎样才能获得大于时间戳的mysql记录,如1386632264作为GET var从html发送? (php和mysql)

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

2 个答案:

答案 0 :(得分:1)

使用timestamp获取mysql UNIX_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

答案 1 :(得分:0)

使用UNIX_TIMESTAMP,例如:

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

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

这是一个示例,用于比较的值取决于您从网页上获取的内容。