holz_bee Posted March 27, 2007 Share Posted March 27, 2007 hello i have been fiddling around with this for hours and got no where so i hope someon can help. i have created a customer table CREATE TABLE CUSTOMER (Customer_ID VARCHAR(30) NOT NULL, First_name CHAR (30) NOT NULL, Last_name CHAR (30) NOT NULL, E_mail VARCHAR (50), Address_1 CHAR(30) NOT NULL, Address_2 CHAR (30) NOT NULL, Address_3 CHAR (30) NOT NULL, Post_Code CHAR (6) NOT NULL, Telephone VARCHAR(13), Password VARCHAR (30) NOT NULL, AVATAR VARCHAR (200), Notes TEXT, Constraint Pk_Customer Primary Key(Customer_ID)) TYPE = INNODB; and it worked fine then i made a second table CREATE TABLE ORDER (Order_ID CHAR(10) NOT NULL, Customer_ID VARCHAR(30) NOT NULL, Constraint Pk_Ord Primary Key(Order_ID), INDEX ( Customer_ID ), Constraint FK_Ord FOREIGN KEY (Customer_ID) REFERENCES CUSTOMER( Customer_ID ) ON DELETE CASCADE) TYPE = INNODB; and i wont add even if i delete the FK! i have then managed to make a table and tryed to alter it using ALTER TABLE ORDER ADD FOREIGN KEY (Customer_ID) REFERENCES CUSTOMER(Customer_ID); any help i will be so greatful! im using PHPmyadmin 2.9.2 Link to comment https://forums.phpfreaks.com/topic/44539-solved-cant-make-tables-and-fk-not-working/ Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.