Jump to content

Duplicate entry '127' for key 1


Nrees87

Recommended Posts

Hi guys, I have a gallery page, that has been working fine for several months now. But all of a sudden when I try and add a new image with the following PHP code:

[code]$imgquery = mysql_query("INSERT INTO mlc_gallery (ItemID,Title,Description,File,Category)". "VALUES ('NULL', '" . $capt . "', '" . $descr . "','". $_FILES['file']['name'] ."', '" . $gallerycat . "')") or die(mysql_error());[/code]

I get the following error:

[code]Duplicate entry '127' for key 1[/code]

The table layout is as follows(information shown is from export table option in MySQL Admin):

[code]CREATE TABLE `mlc_gallery` (
  `ItemID` tinyint(4) NOT NULL auto_increment,
  `Title` varchar(50) NOT NULL default '',
  `Description` text NOT NULL,
  `File` text NOT NULL,
  `Category` tinyint(1) NOT NULL default '0',
  PRIMARY KEY  (`ItemID`)
) TYPE=MyISAM PACK_KEYS=0 AUTO_INCREMENT=127 ;[/code]

I have tried changing the AUTO_INCREMENT value to 128 to overcome this problem, but it stays on 127.

Any help is greatly appreciated.

Nathan Rees
Link to comment
Share on other sites

Guest
This topic is now 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.