[SQL] Duplicate field '0' for key 1

Solved
Absot Posted messages 819 Status Membre -  
Absot Posted messages 819 Status Membre -
Hello, as mentioned in the title, I have this message ( Duplicate of field '0' for key 1 ) that appears after executing my query, but I can't see where the error is coming from because I don't believe there is a duplicate, and especially what key 1 refers to..

Thank you for your help
Configuration: Windows XP Firefox 3.0.10

21 réponses

  • 1
  • 2
dam75 Posted messages 1212 Status Webmaster 67
 
Hello,
you must NOT set the auto_increment field...
so
-> either you set it to NULL
-> or you use the syntax:
INSERT INTO Clients SET nom="$nom", prenom="$prenom", ...
WITHOUT setting the Id...

PS Also be careful to properly escape quotes and others if you are in php: see mysql_real_escape_string, mysql_escape_string, addslashes, ...

Good luck!
5
  • 1
  • 2