Take the 2-minute tour ×
Webmasters Stack Exchange is a question and answer site for pro webmasters. It's 100% free, no registration required.

i got mysql error on this statement i don't know why error is:

#1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'CONSTRAINT fk_objet_code FOREIGN KEY (objet_code) REFERENCES objet(code) ) ENG' at line 6

sql code is

CREATE TABLE IF NOT EXISTS `class` (
  `numero` int(11) NOT NULL AUTO_INCREMENT,
  `type_class` varchar(100) DEFAULT NULL,
  `images` varchar(200) NOT NULL,
  PRIMARY KEY (`numero`)
  CONSTRAINT fk_objet_code FOREIGN KEY (objet_code) REFERENCES objet(code) 
)  ENGINE=InnoDB;;
share|improve this question

closed as off topic by Su', Nick, John Conde Sep 16 '12 at 13:12

Questions on Webmasters Stack Exchange are expected to relate to webmastering within the scope defined by the community. Consider editing the question or leaving comments for improvement if you believe the question can be reworded to fit within the scope. Read more about reopening questions here.If this question can be reworded to fit the rules in the help center, please edit the question.

1 Answer 1

CONSTRAINT fk_objet_code FOREIGN KEY (objet_code) REFERENCES objet(code)

objet_code does not appear to be a column in your table.

share|improve this answer

Not the answer you're looking for? Browse other questions tagged or ask your own question.