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/

-- 
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to