0

You could say I bit off more than I could chew... However, what's done is done and I'm pulling the rest of my hair out and looking to the DaniWeb community for help...

I am building a site that people can log in to and select classes that are owned by different users...

I have 7 tables in my DB

# Class
# ClassDetails
# Owner
# OwnerDetails
# User
# UserClasses
# UserDetails

CREATE TABLE `Class` (
  `CID` int(10) NOT NULL auto_increment,
  `CDID` int(10) NOT NULL,
  `OID` int(10) NOT NULL,
  `CDName` varchar(255) NOT NULL,
  PRIMARY KEY  (`CID`)
) ENGINE=InnoDB AUTO_INCREMENT=2 DEFAULT CHARSET=utf8 AUTO_INCREMENT=2 ;

I have a ton of questions, but, I'll only ask a few... I'm sure I can figure it out with a little direction...

1. How do I apply Foreign keys to tables? If I do, can I update the ClassDetails table and auto populate the Class tables at the same time? When I try to add the Foreign Key now I get "No Index Defined!"...
2. Once the relationship is made using CASCADE can I update one to many rows?

Any help would be great!

Thanks,
Ted

2
Contributors
1
Reply
2
Views
7 Years
Discussion Span
Last Post by theonly
0

The syntax for foreign key is:

FOREIGN KEY('whatever') REFERENCES 'the table

And I'm not quite sure what you are trying to do with the rest of your questions. Sorry I cannot help any further.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.