Re: re:FOREIGN KEY{ERROR:1005/150}

From: Date: Wed, 11 Feb 2009 10:59:00 +0000
Subject: Re: re:FOREIGN KEY{ERROR:1005/150}
References: 1 2 3  Groups: php.db 
Request: Send a blank email to php-db+get-45935@lists.php.net to get a copy of this message
This worked for me: CREATE TABLE hotel ( items_no int(16) NOT NULL auto_increment, INDEX (items_no), PRIMARY KEY (items_no) )ENGINE=INNODB; CREATE TABLE pack ( items_no int(16) NOT NULL auto_increment, INDEX (items_no), PRIMARY KEY (items_no) )ENGINE=INNODB; CREATE TABLE pack_accomodation ( id int(16) NOT NULL auto_increment, pack_id int(16) NOT NULL , hotel_id int(16) NOT NULL , PRIMARY KEY (id), INDEX (pack_id), FOREIGN KEY (pack_id) REFERENCES pack(items_no) ON DELETE CASCADE ON UPDATE CASCADE, INDEX (hotel_id), FOREIGN KEY (hotel_id) REFERENCES hotel(items_no) )ENGINE=INNODB; But my tables are all empty. Maybe you have duplicate id's in one of the tables? No idea what else to suggest apart from joining the mysql list (http://lists.mysql.com/) to see if they have a suggestion. -- Postgresql & php tutorials http://www.designmagick.com/

« previous php.db (#45935) next »