[PHP][MySQL] Daily task

Insidium

New Member
Jan 24, 2015
8
1
I'm struggling to think of a way to make a system which every time a new day starts, it inserts the date into a new row.
Something like
date | field1 | field2
20/1/2015 | 0 | 0
21/1/2015
| 0 | 0
22/1/2015
| 0 | 0
23/1/2015 | 0 | 0

But, ontop of the insertion of the automatic new date entry, every time the user enters the site I need them to be able to change the data of the date.

E.G. If I logged on today, 24/01/2015, there would be a row in the database that contains the date. I then can change the field of today's field1 / field2 (I can do this bit, I just need to know how to make it edit only the day it is on). But, I cannot edit previous days and I cannot enter future days.

Thanks for the help.
 

brsy

nah mang
May 12, 2011
1,530
272
Check out

They have a few examples of how you can run those automatic jobs every x hours. Also, another great thread:
 
Last edited:

Insidium

New Member
Jan 24, 2015
8
1
Check out

They have a few examples of how you can run those automatic jobs every x hours. Also, another great thread:
Thanks for the reply.

What about only being able to edit the row within x hours? Any idea?
 

brsy

nah mang
May 12, 2011
1,530
272
You can have a query like UPDATE TABLE bleh SET field1='nah', field2='nah' WHERE date = 'dynamically define date using a variable (date function)'

You can put that query in an if statement to check if it was already updated, and if not run the query above. I typed this on my phone so there may be something wrong.
 

Insidium

New Member
Jan 24, 2015
8
1
Is there any code that I don't have to have a whole separate 2-3 pages for?

If that is the only way to do it, I'll do it. But, I'd prefer something which I can chuck on the same page as the tool.
 

Users who are viewing this thread

Top