Jump to content

Duplicate Entry For Key1?


localhost

Recommended Posts

[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
Link to comment
Share on other sites

[!--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
Link to comment
Share on other sites

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.
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   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.

×
×
  • 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.