PDA

View Full Version : Insert Error


AndrewElliott
3-23-06, 10:26 AM
I'm getting the following error.
Inserted rows: #1062 - Duplicate entry '127' for key 1Modifications have been saved

I think the trouble is that the autonumber isn't advancing beyond 127...
none of my inserts are going through...
(unless I delete 127, in which case I can insert it again)

Anyone know what is going on, and how I can fix it.

SQL query: INSERT INTO `schedule` ( `id` , `showsid` , `ep_id` , `startdate` , `starttime` , `finishdate` , `sysdate` )
VALUES (
NULL , '5', '0', '2006-03-23 18:00:00', '6 PM', '2006-03-23 18:30:00',
CURRENT_TIMESTAMP
);

mitchind
3-23-06, 11:12 AM
Use phpMyAdmin to see how your 'id' field is defined.

AndrewElliott
3-23-06, 12:10 PM
Field Type Collation Attributes Null Default Extra Action
id int(11) No auto_increment

foofoo
3-23-06, 01:03 PM
instead of inserting NULL use two single quotes.

''

Or try removing that field completely.


INSERT INTO `schedule` (`showsid` , `ep_id` , `startdate` , `starttime` , `finishdate` , `sysdate` )
VALUES ( '5', '0', '2006-03-23 18:00:00', '6 PM', '2006-03-23 18:30:00', CURRENT_TIMESTAMP);

mitchind
3-23-06, 01:22 PM
I'd check your code to make sure you're looking at the right database and table.

It sounds like you have the auto-increment 'id' field defined as tinyint instead of int.

AndrewElliott
3-23-06, 09:56 PM
I'd check your code to make sure you're looking at the right database and table.

It sounds like you have the auto-increment 'id' field defined as tinyint instead of int.
Yep, that did it....

You can always count on Powweb...
:p

Thinks Mitchind