lukerodham Posted May 7, 2011 Share Posted May 7, 2011 Hey guys just wondering if this piece of code is correct because i get a mysql error saying Duplicate entry '*********' for key 2 this is the code i have and table structure. $sql = " INSERT INTO `IP_Address` VALUES(NULL,'".$ip."','".$date."','".$time."') ON DUPLICATE KEY UPDATE `date` = `".$date."`, `time` = `".$time."` "; Quote Link to comment https://forums.phpfreaks.com/topic/235778-on-duplicate-sql-query/ Share on other sites More sharing options...
fugix Posted May 7, 2011 Share Posted May 7, 2011 check this out for examples Quote Link to comment https://forums.phpfreaks.com/topic/235778-on-duplicate-sql-query/#findComment-1211960 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.