i want to execute a script that will update a mysql field on a certain timestamp
..... for eg : after 3600 seconds from now .. mysql field named 'status' should be changed from 0 to 1
how can i do this...
plss help
update mysql field on a certain time
Started by arxh, Jul 30 2010 07:07 AM
7 replies to this topic
#1
Posted 30 July 2010 - 07:07 AM
|
|
|
#2
Guest_johnny.dacu_*
Posted 30 July 2010 - 07:30 AM
Guest_johnny.dacu_*
This can be accomplish with cron jobs. I'm not sure if you can setup one on runtime...
#3
Posted 30 July 2010 - 07:46 AM
is there another way???
if no... can you tell me in detail what i have to do..
actually. users will be submitting their birth date ... and on their birth day at a specific time (say 8 hours) mysql updates ......
so there would be lots of submissions/... and i want everything automated
if no... can you tell me in detail what i have to do..
actually. users will be submitting their birth date ... and on their birth day at a specific time (say 8 hours) mysql updates ......
so there would be lots of submissions/... and i want everything automated
#4
Posted 30 July 2010 - 12:52 PM
Can you describe your requirements a little more?
- A user submits their birthday (on your website?)
- Your PHP page saves it to DB
- On the actual birthday, your DB will need to update a "status" field to "1"
- Does the field need to revert back to "0" after the birthday?
- Do you have access to cron?
- How often is your site accessed? Can you trigger a PHP file within another PHP file that would change the status?
Technically, if you can set a script to update the DB, you can trigger that page many different ways:
- cron
- within another page
- you can even use a free website monitoring tool that'll download the PHP page every hour.. behaving like a cron job
- A user submits their birthday (on your website?)
- Your PHP page saves it to DB
- On the actual birthday, your DB will need to update a "status" field to "1"
- Does the field need to revert back to "0" after the birthday?
- Do you have access to cron?
- How often is your site accessed? Can you trigger a PHP file within another PHP file that would change the status?
Technically, if you can set a script to update the DB, you can trigger that page many different ways:
- cron
- within another page
- you can even use a free website monitoring tool that'll download the PHP page every hour.. behaving like a cron job
Check out our update Guidelines/FAQ. When posting code, remember to use code tags -
.
.
#5
Posted 30 July 2010 - 06:36 PM
no.. the status would not need to revert to 0...
running the script every hour would not work ... coz i want the field to update on the exact timestamp..
for eg: visit 99designs.com >browse projects> click on any project
you'll notice that for the time remaining they have a countdouwn timer....... which runs till the last second.... and when the end timestamp occurs ... the project disappears from the list...
running the script every hour would not work ... coz i want the field to update on the exact timestamp..
for eg: visit 99designs.com >browse projects> click on any project
you'll notice that for the time remaining they have a countdouwn timer....... which runs till the last second.... and when the end timestamp occurs ... the project disappears from the list...
#6
Posted 30 July 2010 - 06:51 PM
You don't have to do this live. just enable due posts at each page show, and the problem is solved. if noone looks at the page, there is no reason to enable it, but then enable as soon as someone looks at it.
Example: Run this query at first part of each page view, before you start listing posts from here
Example: Run this query at first part of each page view, before you start listing posts from here
UPDATE table_name SET active = 1 WHERE active = 0 AND time_field < NOW()
__________________________________________
I study Information Systems at Karlstad University when I'm not on CodeCall
I study Information Systems at Karlstad University when I'm not on CodeCall
#7
Posted 30 July 2010 - 07:23 PM
kkk.... got it
thankss
thankss
#8
Posted 05 August 2010 - 03:03 PM
Good call, Orjan.
Check out our update Guidelines/FAQ. When posting code, remember to use code tags -
.
.


Sign In
Create Account


Back to top









