Jump to content

HELP: Database Question


asda

Recommended Posts

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.

Link to comment
https://forums.phpfreaks.com/topic/56738-help-database-question/
Share on other sites

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

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.