Results 1 to 2 of 2
  1. #1
    Join Date
    Nov 2005
    Posts
    1

    Unanswered: MySQL newbie needs help!

    Okay, I'm putting together my first MySQL database, and this is should be really easy, but I am stuck on this one thing:

    I have a table "customers", which has fields for name, address, tel#, etc.

    I have another table "invoices", where I would like to be able to reference the data from the customers, in such a way that once their name is selected from a dropdown, the fields for address and such fill in automatically (because they are pulling from the same record in the "customers" table)

    Seems easy? I've been messing with primary keys, foreign keys and the rest and can't get it to work. tables are InnoDB. I'm using PHPbuilder to create the web access pages.

    any help would be appreciated.

  2. #2
    Join Date
    Apr 2005
    Location
    Baltimore, MD
    Posts
    297
    If I've understood your question correctly:

    Give each table an id (primary key) and have the invoices table reference the customer table's id.

    For your HTML select, set each option value to the customer's id, and set the 'onselect' property to a function that will load the info from the database for that customer id.

    To build the rest of the site you may need to pay someone .

Posting Permissions

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