Jim MacCormaic wrote:

Hi all. I'm new here, currently implementing my first PHP/MySQL website on an iMac running Mac OS X v.10.2.3.

All has been going really well until just now while I was adding records to the MySQL database. I have a table which includes an auto-incremented field which is set as the Primary key. I was happily entering information and then suddenly got a warning of an error in my MySQL query, telling me that I had a 'duplicate entry "255" for key 1'.

I've checked the relevant table in PHPMyAdmin and, sure enough, under Row Statistic in the Structure option it gives a value of 255 for the Next Autoindex even though that value was already assigned in the previous record. I feel as if I've hit a brick wall on this one. I ran Check Table, Analyze Table and Optimize Table in PHPMyAdmin Operations and all reported 'OK'. I'm using a PHP form to insert the records and have code included to print out the MySQL query and to report errors (hence the warning which I received). The field in question is of type tinyint(4), unsigned, not NULL and, as stated, is the Primary key and set to auto-increment.

Have I hit some sort of limit by reaching an id of 255? If so, can I fix this? Any help would be appreciated, as my database has to all intents and purposes lost its functionality once I cannot add further records.

Jim MacCormaic
Dublin, Ireland
iChat/AIM : [EMAIL PROTECTED]


Change the field type from TINYINT to SMALLINT or MEDIUMINT. UNSIGNED TINYINT only has a range of 0 thru 255.

Regards.

Jasper Bryant-Greene
http://fatal.kiwisparks.co.nz/

Attachment: smime.p7s
Description: S/MIME Cryptographic Signature

Reply via email to