I'm trying to insert a huge list of users to a MySQL database but everytime I try I get the error:
#1062 - Duplicate entry '' for key 2
It gives me this because the 2nd column is blank on quite a lot of the entries, so after it's inserted one blank entry in column 2, it won't let me add another. However, when I added most of the list yesterday I didn't get this error once even though a lot of the entries I added yesterday have a blank cell in column 2 as well. Whats going on?
This is the sql code to insert 1 entry. The rest follow the same format:
INSERT INTO users
(`id`,`title`,`firstname`,`lastname`,`company`,`address`,`city`,`county`
,`postcode`,`phone`,`mobile`,`category`,`email`,`password`,`userlevel`)
VALUES
('','','John','Doe','company','Streeet','city','county'
,'postcode','phone','','category','emial@email.co.uk','','');
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…