Sunday, 15 March 2015

php - Automatically update date column in database -


Hello I have a page that accepts responses based on whether or not a transaction succeeds.

I am trying to update my database record in the case of a successful transaction and update the current date on the start date and also the expiration date after one year I automatically update.

Currently I have been able to update the tracing position for 'Paid', but there is no clue on how to do it for the dates. I want to do it automatically

This is what I have done

  $ tnx_ref = $ _SESSION ['genref']; $ Sql ​​= "Update Transactions" "Set Transaction_Status = 'Paid', 'Start_Date =' start ', Expiryet =' End '". "WHERE tnx_ref = $ tnx_ref";  

With this, the status of transaction was started for paid , start and expiry /

You can use

date / ADAD Set transaction transaction as and curdate function

  Transaction_Status = 'paid', Start_Date = curdate (), Expiry_Date = date_add (curdate) ), Interval 1 year) where TNX_F = $ tnx_f  

update with date for the "date of expiration" Or if I want to reduce it one day. " Transactions SET Transaction_Status = 'paid', Start_Date = curdate (), Expiry_Date = date_sub (date_add (curdate, interval 1 year), interval 1 day) WHERE tnx_ref = $

  Tnx_ref  

No comments:

Post a Comment