localhost Posted June 27, 2006 Share Posted June 27, 2006 [code]$query = "INSERT INTO `content` ( `id` , `parentid` , `order` , `text` , `date` , `alttext` , `icon` , `type` , `status` , `permission` , `poster` , `mod` , `count1` , `count2` ) VALUES ('0', '-1', '1', 'Powered by dotOmega', '0000-00-00', '', '', '0', '0', '1', '0', '0', '0', '0');";$result = mysql_query($query) or die('Query failed: ' . mysql_error() . '<hr><b>Error: E004</b>');$query = "INSERT INTO `content` (`id`, `parentid`, `order`, `text`, `date`, `alttext`, `icon`, `type`, `status`, `permission`, `poster`, `mod`, `count1`, `count2`) VALUES ('1', '0', '1', 'Your dotOmega Forum', '$date', 'Thank you for installing dotOmega Forum System, you may edit this forum to your liking.', '', '2', '0', '1', '','', '', '')";$result = mysql_query($query) or die(mysql_error());[/code]thats the code and heres the error:Duplicate entry '1' for key 1 Quote Link to comment https://forums.phpfreaks.com/topic/13036-duplicate-entry-for-key1/ Share on other sites More sharing options...
jvrothjr Posted June 27, 2006 Share Posted June 27, 2006 [!--quoteo(post=388557:date=Jun 27 2006, 01:08 PM:name=localhost)--][div class=\'quotetop\']QUOTE(localhost @ Jun 27 2006, 01:08 PM) [snapback]388557[/snapback][/div][div class=\'quotemain\'][!--quotec--][code]$query = "INSERT INTO `content` ( `id` , `parentid` , `order` , `text` , `date` , `alttext` , `icon` , `type` , `status` , `permission` , `poster` , `mod` , `count1` , `count2` ) VALUES ('0', '-1', '1', 'Powered by dotOmega', '0000-00-00', '', '', '0', '0', '1', '0', '0', '0', '0');";$result = mysql_query($query) or die('Query failed: ' . mysql_error() . '<hr><b>Error: E004</b>');$query = "INSERT INTO `content` (`id`, `parentid`, `order`, `text`, `date`, `alttext`, `icon`, `type`, `status`, `permission`, `poster`, `mod`, `count1`, `count2`) VALUES ('1', '0', '1', 'Your dotOmega Forum', '$date', 'Thank you for installing dotOmega Forum System, you may edit this forum to your liking.', '', '2', '0', '1', '','', '', '')";$result = mysql_query($query) or die(mysql_error());[/code]thats the code and heres the error:Duplicate entry '1' for key 1[/quote]DB structure is one of your fields primary Key (maybe ID) and 1 is already definded and there are no dup's definded for the field..... I would check your DB structure on this one Quote Link to comment https://forums.phpfreaks.com/topic/13036-duplicate-entry-for-key1/#findComment-50148 Share on other sites More sharing options...
Orio Posted June 27, 2006 Share Posted June 27, 2006 I think your id column is auto_increment.So in your queries do this for example:INSERT INTO `content` ( `id` , `parentid` , `order` , `text` , `date` , `alttext` , `icon` , `type` , `status` , `permission` , `poster` , `mod` , `count1` , `count2` ) VALUES ([b]''[/b],....Orio. Quote Link to comment https://forums.phpfreaks.com/topic/13036-duplicate-entry-for-key1/#findComment-50150 Share on other sites More sharing options...
localhost Posted June 27, 2006 Author Share Posted June 27, 2006 Thanks Orio, it was due to auto increment, using just '' as opposed to '1' worked wonderfully. Quote Link to comment https://forums.phpfreaks.com/topic/13036-duplicate-entry-for-key1/#findComment-50257 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.