Jump to content

ON DUPLICATE sql query


lukerodham

Recommended Posts

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."`

 

";

 

tb.png

 

 

Link to comment
https://forums.phpfreaks.com/topic/235778-on-duplicate-sql-query/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.