Jump to content
  • 0

sql query command question


Kudo

Question


  • Group:  Members
  • Topic Count:  52
  • Topics Per Day:  0.01
  • Content Count:  129
  • Reputation:   0
  • Joined:  08/18/12
  • Last Seen:  

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?

Link to comment
Share on other sites

2 answers to this question

Recommended Posts

  • 0

  • Group:  Members
  • Topic Count:  50
  • Topics Per Day:  0.01
  • Content Count:  1702
  • Reputation:   238
  • Joined:  09/05/12
  • Last Seen:  

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
Link to comment
Share on other sites

  • 0

  • Group:  Members
  • Topic Count:  52
  • Topics Per Day:  0.01
  • Content Count:  129
  • Reputation:   0
  • Joined:  08/18/12
  • Last Seen:  

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

Link to comment
Share on other sites

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.

×
×
  • Create New...