Hey Guys,
I have two tables in the database, one is the product information, and if the product is in a food group, a nutrition guide table is also used.
What I need is to have the Product information loop in a while statement, so it shows all products, and at the same time, it has to pull all rows from the nutrition guide table that refer to a particular food when it gets to that food product, so esentially, it is a loop inside another loop.
Eg.
Code: Select all
+----------+----------+
| id | product |
+----------+----------+
+----------+----------+
| 1 | apple |
+----------+----------+
| 2 | orange |
+----------+----------+Code: Select all
+----------+----------+----------+----------+----------+
| id | prodid | cat | serving | whole |
+----------+----------+----------+----------+----------+
+----------+----------+----------+----------+----------+
| 1 | 1 | fat | .5g | 1.5g |
+----------+----------+----------+----------+----------+
| 2 | 1 | sugar | 20g | 40g |
+----------+----------+----------+----------+----------+Does anyone know how I could do this?