Solved

Trying to get some database advise for linking tables or a better method

Posted on 2011-03-03
4
214 Views
Last Modified: 2012-05-11
If you goto http://realitguy.com/helpdesk
username and password is: admin

Click customers, then select michael scofield (or anyone).
It take you to a page that shows all the details about that particular customer. The table that the data is pulled from is called "customers".

Now I want to add some items to these customers. Lets say the customer has 10 trucks. I want to be able to display that this customer has 10 trucks on the customer details page. Some customers may have more than 10 and some may  5 trucks and 5 cars.

So to create this feature, I think I will have to create another form, and a new table called "assets". How do I link my customers with the assets table? Do I create a a field in assets called "cust_id" and insert the customer's id in that field? or is there a better method?
0
Comment
Question by:cnl83
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
4 Comments
 
LVL 70

Accepted Solution

by:
Jason C. Levine earned 500 total points
ID: 35033848
>> Do I create a a field in assets called "cust_id" and insert the customer's id in that field?

Yes.  The second table will have an auto-incrementing primary key and the second field as you have it above.

That will allow you to create a one-to-many relationship between your customers table and your assets table and also use the same value (the customer ID) to pull all of the information about a client.
0
 

Author Comment

by:cnl83
ID: 35037156
Ok, I will create the form and report back.
0
 

Author Closing Comment

by:cnl83
ID: 35039217
Thanks for all your help. This worked perfectly. Once I created that field to capture the customer id, it was easy. Dreamweaver's wizard makes this clean and easy.
0
 
LVL 70

Expert Comment

by:Jason C. Levine
ID: 35039255
Excellent.  DW helps you get started but you will quickly reach the limit of the built in behaviors.  Once you start coming up with applications that the built in stuff can't handle, you will either need to learn a bit of php so you can hand code stuff or you buy extensions for Dreamweaver to handle the more advanced stuff with wizards.  
0

Featured Post

Online Training Solution

Drastically shorten your training time with WalkMe's advanced online training solution that Guides your trainees to action. Forget about retraining and skyrocket knowledge retention rates.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Part of the Global Positioning System A geocode (https://developers.google.com/maps/documentation/geocoding/) is the major subset of a GPS coordinate (http://en.wikipedia.org/wiki/Global_Positioning_System), the other parts being the altitude and t…
Many old projects have bad code, but the budget doesn't exist to rewrite the codebase. You can update this code to be safer by introducing contemporary input validation, sanitation, and safer database queries.
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.

732 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question