lundi 30 mai 2016

Automatically update data in sql for a webpage

So Im a softwarwe Development student and for my web class I created a proyect that uses among other things Php and Sql; In this page proyect users can create posts and other users can comment on them.

The thing is I want posts to only be available for a certain period of time.

Then I have a sql table named 'Posts' and they have a column named 'Status' (you know, if the status its 0 they're not available and else they are.)

When user creates a post I make Sql: INSERT INTO posts *All the post data*, I set the Status to 1 and make a TIMESTAMP to register the date of creation of the post. I want that a week after the date registered in the Timestamp change the status column to 0 but I don't want it to be with a page request (because I want the user to be notified via email or something)

Can it be made with some python cgi that checks the date, updates the Status and sends the email or is there a better/easier way to do it?

Thanks a lot for your help :)




Aucun commentaire:

Enregistrer un commentaire