By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
424,952 Members | 909 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 424,952 IT Pros & Developers. It's quick & easy.

Problem setting foreign key using phpmyadmin

P: 78
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`
I get an error of check datatypes. I'm not sure what I am doing wrong. Any Ideas?
Jan 13 '12 #1
Share this Question
Share on Google+
1 Reply

P: 78

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.