Patrick, >I wasn't on the list when the thread below started, but I saw it on google >and wanted to add some more information, but this time, my columns aren't >char based and I get the same error. Here's my SQL:CREATE TABLE `user` ( > `user_id` int(11) NOT NULL auto_increment, > `username` varchar(30) NOT NULL default '', > `firstname` varchar(30) NOT NULL default '', > `lastname` varchar(30) NOT NULL default '', > `email` varchar(100) NOT NULL default '', > `password` varchar(8) NOT NULL default '', > `admin` char(1) NOT NULL default 'N', PRIMARY KEY (`user_id`), > UNIQUE KEY `username` (`username`)) TYPE=innodb >CREATE TABLE `wishlist` ( > `wishlist_id` int(11) NOT NULL auto_increment, > `user_id` int(11) NOT NULL, > PRIMARY KEY (`wishlist_id`), > FOREIGN KEY (`user_id`) REFERENCES `user` (`user_id`) > ) TYPE = innodb
you must explicitly create an index on user_id in table wishlist. This is mentioned in the manual. Both the referenced column and referring column must appear as the first column in an index. >I am hoping I am just making some strange mistake. Also of note, I created >the wishlist table once before without the foreign key constraint and dropped >it. I have read that there might be some problems there too, but if I take >out the Foreign Key constraint it creates the wishlish table which leads me >to believe this isn't that problem. > >Thanks, >Patrick Burleson Regards, Heikki Tuuri Innobase Oy --- Order commercial MySQL/InnoDB support at https://order.mysql.com/ See http://www.innodb.com for the online manual and latest news on InnoDB --------------------------------------------------------------------- Before posting, please check: http://www.mysql.com/manual.php (the manual) http://lists.mysql.com/ (the list archive) To request this thread, e-mail <[EMAIL PROTECTED]> To unsubscribe, e-mail <[EMAIL PROTECTED]> Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php