This is partially a suggestion and partially a request for assistance. I am trying to have the children of the chosen forum also displayed on the frontpage, however I am having trouble with the sql.
What I am trying to do is:
1) Get all msgs where t.ID_BOARD == XX (where XX is the specified board)
2) OR where the b.ID_PARENT == t.ID_BOARD
3) AND where the m.ID_MSG = t.ID_FIRST_MSG
So my first idea was to just include it where the ID_PARENT == ID_BOARD then I realized that I need to get the ID_BORD of the children and add them. So I am doing a nested Select statement to gather the children's ID's and then just include them in the or statement. But it is to no avail.
SELECT m.icon, m.subject, m.body, IFNULL( mem.realName, m.posterName ) AS posterName, m.posterTime, t.numReplies, t.ID_TOPIC, m.ID_MEMBER, m.smileysEnabled, b.name AS boardName
FROM smf_topics AS t, smf_messages AS m, smf_boards AS b
LEFT JOIN smf_members AS mem ON ( mem.ID_MEMBER = m.ID_MEMBER )
WHERE (t.ID_BOARD ='2' OR t.ID_BOARD = (
FROM smf_boards AS bb
WHERE t.ID_BOARD = bb.ID_PARENT)
) AND m.ID_MSG = t.ID_FIRST_MSG) AND
ORDER BY m.ID_MSG DESC
LIMIT 0, 30
1) Should I just do multiple sql statements and code up the check in PHP or should I continue using SQL?
2) If I use php how would I go about resorting the $return array? (Lines 1361-1439)
3) Should I redesign the $return array to be a hash table where the key is the date/msg ID and thus they will be added chronologically?
4) OR should I redesign the output to check the post date/msg ID thus outputting it chronologically?