Nrees87 Posted July 17, 2006 Share Posted July 17, 2006 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 https://forums.phpfreaks.com/topic/14875-duplicate-entry-127-for-key-1/ Share on other sites More sharing options...
AndyB Posted July 17, 2006 Share Posted July 17, 2006 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. Link to comment https://forums.phpfreaks.com/topic/14875-duplicate-entry-127-for-key-1/#findComment-59578 Share on other sites More sharing options...
Nrees87 Posted July 17, 2006 Author Share Posted July 17, 2006 AndyB, thanks a lot, problem solved.Nathan Rees Link to comment https://forums.phpfreaks.com/topic/14875-duplicate-entry-127-for-key-1/#findComment-59592 Share on other sites More sharing options...
Recommended Posts