Hi,
I thought I'd have a look into creating a page structure using Mysql and then fetching the result set to create a nice set of pages/ sub pages.
I wanted to create a quick test to see if the result would work.
PAGE TABLE
pID
pTITLE
pCONTENT
pPubDate
SUBPAGE TABLE
pID
subID
Now lets say the result would be bellow
PAGE TABLE
pID : 1
pTITLE :HOME PAGE
pCONTENT : this is the home page content
pPudDate : 2009-06-17
pID : 2
pTITLE :MEMBER
pCONTENT : this is the members page content
pPudDate : 2009-06-17
pID : 3
pTITLE : USER Mr Bash
pCONTENT : this is Mr Bash's member page
pPudDate : 2009-06-17
SUBPAGE TABLE
pID 2
subID 3
the subpage table basically is saying that ID 2 from table 1 is the parent of ID 3. Now the issue is how can I create an SQL query to list the parent and the child within one table.
PARENT - title CHILD -title
MEMBER USER Mr Bash
this way I can easily output the results without needing two seperate results set within PHP. I'd rather use a complex JOIN etc than creating multiple simple querys and try joining it.
Would it be best to create a query using the above db table design or would you use a different design method?
If anyone could create a query or give me an idea how to create the DB Tables better then please do so.
thank you.