Re: [PHP-DB] re:FOREIGN KEY{ERROR:1005/150}

[email protected] (chris smith)
Newsgroups php.db
Message-ID <[email protected]>
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/
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.