Jump to content


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


Duplicate entry '127' for key 1

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',

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

Share this post

Link to post
Share on other sites
You'll need to change from the tinyint definition (which has a limit of +127) to smallint or any number field that accepts larger values.

Share this post

Link to post
Share on other sites
This topic is now closed to further replies.


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.