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
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

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.