Jump to content
  • 0

sql query command question


Question

Posted

i have some question guys!.. 

This is my query in some script
query_sql "UPDATE go_premium SET `expiration_date` = DATE_ADD(NOW(), INTERVAL 7 DAY) WHERE `account_id` = "+ getcharid(3) +"";

it works fine for me but my question is how can i change the "DATE_ADD(NOW(), INTERVAL 7 DAY" to  the value of the expiration date table + 7 days can someone teach me some tricks?

2 answers to this question

Recommended Posts

  • 0
Posted (edited)

Change

DATE_ADD(NOW(), INTERVAL 7 DAY)

To

COALESCE(DATE_ADD(`expiration_date`, INTERVAL 7 DAY), DATE_ADD(NOW(), INTERVAL 7 DAY))

 

Edited by Patskie
  • 0
Posted
On 8/9/2020 at 2:07 PM, Patskie said:

Change


DATE_ADD(NOW(), INTERVAL 7 DAY)

To


COALESCE(DATE_ADD(`expiration_date`, INTERVAL 7 DAY), DATE_ADD(NOW(), INTERVAL 7 DAY))

 

why do i need to  add the date_add(now(), interval 7 day)) on the last part?
DATE_ADD(NOW(), INTERVAL 7 DAY)) is for new record right ? correct me if im wrong
i just need to update the the expiration_date to 7 more days when i click some items...

image.thumb.png.13b7ec885a0beddead662df907bc856e.pngi can 

i found some error when trying the script sir... please help me 

sorry for the post but i manage to fixed it.. i forgot to add the other codes... thanks anyway @Patskie

Join the conversation

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

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  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.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...