This topic is locked

autopopulate fileds

3/10/2006 7:54:54 PM
PHPRunner General questions
D
Donald Ackley author

I have searched the forums but can't seem to find a clear answer to my issue. I would like to have two tables. Say the first table is a parts list with a unique number as a key followed by several fields for price source description etc. In the second table would be a listing of parts required to make a machine using some of the parts from the parts list table. When displaying on the webpage, I would like to display a list of the parts needed to make the machine (from the second table) and have fields like price, source and description display from the first table so that all of the information on the part does not need to be entered into both tables?
Does this make sense (yes I am kinda new at this!)

Thanks for any help you can provide.
-Donald

Sergey Kornilov admin 3/13/2006

Donald,
you can do it to join first and second tables in one query. For example,

select table1.fieldname1,

table1.fieldname2,

table1.fieldname3

table2.fieldname4

table2.fieldname5

from table1 inner join table2 on table1.ID=table2.ID



Insert this query on the Edit SQL query Tab.

D
Donald Ackley author 3/13/2006

Donald,

you can do it to join first and second tables in one query. For example,

select table1.fieldname1,

table1.fieldname2,

table1.fieldname3

table2.fieldname4

table2.fieldname5

from table1 inner join table2 on table1.ID=table2.ID



Insert this query on the Edit SQL query Tab.


Thanks Sergey, I will give this a try. May be a dumb question but I notice the first two lines have commas but the rest do not, does this matter?
-Donald

Sergey Kornilov admin 3/14/2006

Donald,
sorry my fault. Correct query is:

select table1.fieldname1,

table1.fieldname2,

table1.fieldname3,

table2.fieldname4,

table2.fieldname5

from table1 inner join table2 on table1.ID=table2.ID
D
Donald Ackley author 3/15/2006

Donald,

sorry my fault. Correct query is:

select table1.fieldname1,

table1.fieldname2,

table1.fieldname3,

table2.fieldname4,

table2.fieldname5

from table1 inner join table2 on table1.ID=table2.ID


Thanks Sergey, With a little experimenting, thanks to above code, I have got it working!

Really appreciate your help on this.
-Donald