I am completely stuck here and really need some help.
I have a MySQL database which has 3 tables storing information relating to the pages of a website.
The first table contains pretty much all the main info and is called tbl_pages :
page_id (primary key)
page_menu_title (which is what is to be displayed as the anchor text for it in the menu)
The second table is called tbl_pages_parents and contains two fields used to specify which page is the parent of each page:
The final table is called tbl_pages_order and is used to store the order of each page should be show within its parent page group
So for example I'll give a indented list of pages in the format [page_menu_title][page_id][parent_page_id][page_order] as they would currently be stored in the database
--------[Window Cleaning] 
--------[Car Wash] 
----------------[Wash Only] 
----------------[Wash and Wax] 
----------------[Wash, Wax and Vac] 
[About Us] 
[Contact us] 
As you can see the page_id values have no bearing on either the order, or the menu level of the page, they are merely used as a reference in the other tables.
What I am struggling to do is create a query which can run through each of the tables, build a multidimensional array containing all relevant details of each page and then output it to create an indented list (like the one above) which is in the correct order, and has sub menu items correctly nested.
Basically I guess you could describe it that from this structure I am looking to create a sitemap page
Also just to point out, one problem I am having is that there isn't a limit to how deep the menu can go, so for example some pages may be 6 levels in (i.e the child of a child of a child of a child of a child of the top)
Any help would be greatly appreciated, and if any further clarification is needed please shout and I'll do my best to explain.
Many thanks in advance