I have a MySQL Table, let's say for blog posts. They have a column status which cam be active or inactive and two columns which are optional: publish date and expire date for scheduling posts.
Which solution do you recommend for changing the status depending on the publish date and expire date? Can I do this with a PHP script or cronjob ?
EDIT 30.11.16 / 16:50
Perhaps I have to be more precise about my specific problem: I have a magento store and I would like to add the possibility to schedule teasers. I want to change the existing code as little as possible.
I would say, it depends, but as @ADyson sad you should't only work with a cronjob, because it show some posts that should have been expired.
But you think about to write a single class/function that handle the status and expiration / publish date logic. It will be a mess later, if you have the code copy in the cronjob and on different output pages.
I also would think about the status field, maybe it is not necessary, if you make some MySQL Selects like