开发者

Mysql, php query WHERE statement, recordset expire in +1 day of post date?

I ba开发者_高级运维sically have a simple calendar I set up. As of now, it shows "future" events. And then the event expires that day... I would love to find a WHERE statement that I can use to have that "event" stay up for 1 day past the "post_date"

(so if I post it as Nov. 15th,) The event would show: Name of event - Nov. 15th

And It would stay active until +1 day from post_date? (Nov. 16th would be the expire date)

Here is what I have so far:

WHERE DATE(FROM_UNIXTIME(`date`)) >= DATE(NOW())

Thanks in advance...


WHERE post_date > DATE(NOW())-INTERVAL 1 DAY

and if you really want to keep your post_dates in UNIX timestamps:

WHERE FROM_UNIXTIME(post_date) > DATE(NOW())-INTERVAL 1 DAY


Change your where statement to:

WHERE DATE(FROM_UNIXTIME(`date`)) + INTERVAL 1 DAY >= CURDATE();

Also a good idea to to use real SQL dates instead of UNIX timestamps. There are functions to do calculations on them.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜