468,514 Members | 1,550 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 468,514 developers. It's quick & easy.

Problem setting foreign key using phpmyadmin

I currently have two tables: tblCustomer and tblOrders.
In tblCustomer I have a field CustomerID that was set with the SERIAL datatype and set as PRIMARY. In tblOrders I have the fields OrderID that was set with the SERIAL datatype and set as PRIMARY. I also have a field called CustomerID with the BIGINT(20) datatype. I am trying to create a foreign key on tblOrders.CustomerID to relate back to tblCustomer.CustomerID. All the data is InnoDB.
Expand|Select|Wrap|Line Numbers
  1. ALTER TABLE  `tblOrders` ADD FOREIGN KEY (  `CustomerID` ) REFERENCES  `Sample`.`tblCustomer` (
  2. `CustomerID`
  3. ) ON DELETE CASCADE ON UPDATE CASCADE ;
I get an error of check datatypes. I'm not sure what I am doing wrong. Any Ideas?
Jan 13 '12 #1
1 3397
SOLVED

tblOrders.CustomerID was not set with the unsigned attribute as tblCustomer.CustomerID was.
Jan 13 '12 #2

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

2 posts views Thread by Kamlesh | last post: by
reply views Thread by Martin Bischoff | last post: by
reply views Thread by cty | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.