asda Posted June 22, 2007 Share Posted June 22, 2007 So i have a form in PHP that adds whatever the user enters into it to a table on the database. I dont know much about SQL or PHP and this is as far as i could get (with a tutorial). Now i want to add a 10minute countdown onto it and after the 10minutes it is disabled. I was thinking having a new peice on the table called Time and when it is submitted it starts at 10, every minute it decreases by one and then deletes. How do i do this though please help Sorry if its not the right section. Quote Link to comment https://forums.phpfreaks.com/topic/56738-help-database-question/ Share on other sites More sharing options...
bubblegum.anarchy Posted June 22, 2007 Share Posted June 22, 2007 Some tables have a date_created column defined as a timestamp or datetime - I suggest that you add a simliar column if one does not already exists to the table in question. Then you can check the current timestamp against the stored value when updating the record, the final fail safe query would look something like this: UPDATE repository SET item = {$value} WHERE id = {$id} AND date_created > CURRENT_TIMESTAMP - INTERVAL 10 MINUTES Quote Link to comment https://forums.phpfreaks.com/topic/56738-help-database-question/#findComment-280531 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.