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

Please sign in to comment

You will be able to leave a comment after signing in



Sign In Now
Sign in to follow this  

×
×
  • Create New...

Important Information

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