MySQL Lists are EOL. Please join:

List:General Discussion« Previous MessageNext Message »
From:B. Joseph Burch Date:September 16 2003 11:57pm
Subject:URGENT: foreign/linked table keys
View as plain text  
Hello - I've got a simple MySQL/PHP database set up with 3 tables plus a "relationship"
table (using phpMyAdmin.)  The end result is for students to be able to dynamically find
out what books are required for their classes by selecting; term ---> course --->
instructor  ---> (results)

The tables look like this:

BOOKS
  bookID (primary auto increm)
  skuID (unique)
  text_title
  text_author
  price
  status

CLASSES
  classID (primary auto increm)
  course_number
  course_name
  term
  bookID (foreign key from BOOKS)

INSTRUCTORS
  instrID (primary auto increm)
  name

CLASS_BOOKS (relationship table)
  ID (primary auto increm)
  bookID (foreign key from BOOKS)
  classID (foreign key from CLASSES)
  instrID (foreign key from INSTRUCTORS)

The standard rules apply:
  Multiple books for instructors
  Multiple instructors for classes
  Multiple books for classes
  etc.

I've successfully set up and linked separate admin pages in Dreamweaver to submit data
into the 3 primary tables and they work just fine.  (Yes, I'm a newbie letting Dreamweaver
do most of my coding.)

My question is how do i get the primary keys from each of those 3 tables to feed their
info into the relationship table "class_books"?  (I saw something in the phpMyAdmin
documentation about configuring it to "link" tables(?)) Or do I even need to?  Is it
accomplished though coding in the mysql table or through PHP code?  Does someone know a
tutorial example of this already being done somewhere?  I'm so confused.

Sorry for the long post but I'm trying to be as clear as possible. Of course, I'm on a
deadline and need to get this worked out pretty quickly.

Thanks for your help.

Thread
URGENT: foreign/linked table keysB. Joseph Burch17 Sep
  • URGENT: foreign/linked table keysJoseph Burch17 Sep