Jump to content

Publishing in the future


erme

Recommended Posts

Hi, I've created a CMS that enables the user to publish an article which will appear on the site immediately. I need to add in the option to schedule displaying the article.

 

I have a field in the MySQL table for pubished_date. How can I write something in PHP that won't display articles where published_date is in the future / hasn't arrived yet?

 

I could then maybe set up a cron job to run the script every night.

 

Thanks in advance...

Link to comment
https://forums.phpfreaks.com/topic/277494-publishing-in-the-future/
Share on other sites

Store them as normal. Your script that displays posts, should only query for posts where the published date is in the past.

 

SELECT * FROM posts WHERE published_date <= NOW()

 

etc.

 

Thanks for your reply. What format will the date and time need to be stored as for this to work? Currently it is stored like this 2013043014:14:35

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.