Jump to content
  • 0
Sign in to follow this  
astralprojection

SQL: INSERT, Update if not exist

Question

@AnnieRuru i was trying to make some mod on your script VIP SYSTEM. I want to prevent inserting new record for  same char_id each time it expire and avail again. The query_sql seems not update the record. thanks :D

 

CREATE TABLE `vip_system` (
 `char_id` int(11) unsigned NOT NULL,
 `start_time` datetime DEFAULT NULL,
 `end_time` datetime DEFAULT NULL,
 PRIMARY KEY (`char_id`),
 UNIQUE KEY `char_id` (`char_id`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1
query_sql "INSERT INTO `vip_system` VALUES ("+ getcharid(CHAR_ID_CHAR) +", NOW(), DATE_ADD(NOW(), INTERVAL "+ 1 +" WEEK)) ON DUPLICATE KEY UPDATE `char_id` = "+getcharid(CHAR_ID_CHAR);

 

Share this post


Link to post
Share on other sites

0 answers to this question

Recommended Posts

There have been no answers to this question yet

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.   Restore formatting

  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.

Loading...
Sign in to follow this  

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.