Jump to content

pulling from table then table again


iversonm

Recommended Posts

lets say i have a table called, vegies

it the table vegies have multiple lines each with the row name called=  corn, potatoes, beans, carrots, pea, and turnips

 

now lets say i want to pull from the database but for each row there is also another table called corn, potatoes, beans, carrots, pea, and turnips

 

this is what i dont know how to do

if i want to take the results from the table vegies and then take it and pull from the table that corrispons to the row so like in the row corn it would pull info from the table corn

 

im sorry if this doesnt make sense let me know

Link to comment
https://forums.phpfreaks.com/topic/119606-pulling-from-table-then-table-again/
Share on other sites

You would have to first read from the vegies table, then use that value to form the second query and run that separately (the value retrieved from the vegie table will be the table name value for the second query). This approach is very limiting.

 

You should not organize your data in that way - a table for each type of veggie. Ideally you would have all vegies in one table and you could have another column to designate further what it is (starch food, yellow food, green food, etc.).

 

Learn about database normalization:

http://www.google.com/search?hl=en&q=database+normalization

 

 

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.