Query within a while loop of a query

admin

Administrator
Staff member
Hello guys,

I have a problem that I need help with:

I am trying to run two querys within a page. The second query is to be nested within the while loop of the first query. I would like my data displayed like this:

----------------
MAIN TITLE 1
-------
sub title 1
sub title 2
sub title n
------

-----------------
MAIN TITLE 2
------
sub title 1
sub title n
------

and so on...

There is a one to many relationship between main title ans sub title, so they are (and need to be) in different tables - I have the correct query already - as i can get one result to appear.

It appears that you cannot put a while loop within another while loop, as the inner loop terminates the outer loop prematurely - This is why I can only return one main title loop.

Is there another way around this??

Thanks
 
Back
Top