Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    New Coder
    Join Date
    Sep 2010
    Location
    The Twilight Zone
    Posts
    86
    Thanks
    17
    Thanked 2 Times in 2 Posts

    create join table problem

    Hey guys,

    I have 3 tables

    customer, menu, and order. The order table is suppose to join the customer and menu tables, and contains the primary keys of both. Here's how I tried to create the order table on phpmyadmin.

    PHP Code:
    create table order(
    customerID int not null,
    itemID int not null,
    primary key (customerIDitemID),
    foreign key(customerIDreference customer(ID),
    foreign key(itemIDreference menu(itemID)

    This doesn't work. What am I doing wrong?!!

  • #2
    Supreme Master coder! Old Pedant's Avatar
    Join Date
    Feb 2009
    Posts
    25,550
    Thanks
    78
    Thanked 4,382 Times in 4,347 Posts
    Well, for one thing, the keyword is references with an "s" on the end.

    Other than that, it looks okay. What message do you get?
    An optimist sees the glass as half full.
    A pessimist sees the glass as half empty.
    A realist drinks it no matter how much there is.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •