3

Databse table-

     id        created_date             timer     status 
      1    2013-02-25 16:40:45           1        Y  
      2    2013-02-25 16:40:45           2        Y  
      3    2013-02-25 16:40:45           0        Y 

This is my database table.

created_date field is datetime and timer is varchar value (integer value)

what I want is to set status N for every day at 12:00 AM and when timer value is not 0 then set status=N by adding timer+created_date , all status change to N at 12:00 AM weather timer set or not.

Rahman Haroon
  • 462
  • 1
  • 5
  • 17
Vaibhav Agarwal
  • 239
  • 5
  • 19

2 Answers2

0

Try this:

Update tableName
set status = 'N'
where time <> 0 and time(created_date) = '12:00:00'

Then to update the date with the time value assuming its in seconds you do this

Update tableName
set created_date= AddTime(created_date, timer)
where status = 'N' 
Mortalus
  • 10,046
  • 9
  • 60
  • 108
0

you must take advantage of cronjob.

some helpful links are :

http://net.tutsplus.com/tutorials/php/managing-cron-jobs-with-php-2/

https://my.bluehost.com/cgi/help/168

Dipesh Parmar
  • 25,931
  • 6
  • 53
  • 85