PDA

View Full Version : MySQL problem



hamza84
August 19th, 2003, 01:33 PM
I'm trying to insert values into a database but I keep getting this mysql error that says

"Duplicate entry '0' for key 1"

Can anybody tell me what this means?

Jubba
August 19th, 2003, 02:49 PM
it means that there is a duplicate entry where there shouldn't be. It means that you have the database set up so that certain field can not have duplicate entries. Your best bet is install phpMyAdmin so that you can easily fix and set up your databases...

Voetsjoeba
August 19th, 2003, 02:50 PM
www.phpmyadmin.net ;)

hamza84
August 19th, 2003, 05:06 PM
Thanks a bunch for your help guyz.

Yates
August 22nd, 2003, 01:57 AM
Each row in a mySQL database must have a unique ID, or primary key. I recommend in your table specfics setting that primary key (which is almost always the first column) to AUTO_INCREMENT, NOT NULL, and if it isn't already.

This way, you can write INSERT INTO Table VALUES('','data','data'....); and your key will auto increment for you and it will be unique.