I had been facing problems in creating mysql using foreign key.
The problems falls on the userID foreign in Combination. They prompt me error (Error 1064: You have an error in your sql syntex. Check the manual that corresponds to your mySQL server version for the right syntex use near 'User(userID) ON UPDATE CASCADE ON DELETE CASCADE) TYPE=INNODB'). This problem does not occur when i create other tables. Thus it should not be syntex error. I would appretiate if somebody could help me to solved it. Thank alot. =)
=========================================
CREATE TABLE User
(
userID VARCHAR(255) NOT NULL,
firstName VARCHAR(255),
lastName VARCHAR(255),
shipAdd TEXT,
userStatus VARCHAR(255),
pswd VARCHAR(8),
dateJoined INT,
PRIMARY KEY(userID)) TYPE=INNODB;
CREATE TABLE Combination
(
coID INT NOT NULL AUTO_INCREMENT,
itemID INT NOT NULL,
userID VARCHAR(255),
PRIMARY KEY(coID),
INDEX(itemID),
INDEX(userID),
FOREIGN KEY(itemID) REFERENCES Items(itemID) ON UPDATE CASCADE ON DELETE CASCADE,
FOREIGN KEY(userID) REFERENCES User(userID) ON UPDATE CASCADE ON DELETE CASCADE) TYPE=INNODB;
=========================================