If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > MySQL > MySQL newbie needs help!

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 11-15-05, 00:45
KickTheBobo KickTheBobo is offline
Registered User
 
Join Date: Nov 2005
Posts: 1
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.
Reply With Quote
  #2 (permalink)  
Old 11-15-05, 10:26
jfulton jfulton is offline
Registered User
 
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 .
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On