In addition to making sure both tables are type InnoDB, also make sure you have indexed both the foreign key and its corresponding reference first (this will fix the obtuse errno(150) message). One suggestion I have is to take a bootcamp style class, even online, to solidify the grasp of database concepts. I created my first site without completely understanding data modelling, other than the lip service paid in the reference books - sure we can all list the five norms but to apply that knowledge is another thing. and I cringe at some of the hacks I then employed. I'm sure you're under a tight deadline, but take it from someone who learned the hard (and hardheaded) way, it's worth your time to take a class first. Or, it may be time to hire a consultant to work with you one on one. There are plenty of developers who would love to break down everything for you, so long as they are compensated for their time.