In my database I have questions and answers. Every post has a 'postID' and only answers have a 'responseID', which references the 'postID' of the question.
I can identify which answers go to which question since responseID = postID
I'd like to write some php code that would display the data in the following format:
Question:
- answer
- answer
- answer
Question:
- answer
- answer
- answer
...and so on
Additional Info:
The Questions and Answers are in the same tblQA table. The colums are QAID, PosterID, ResponseID, TimeStamp, Category, Body.
So, every post has a QAID. A question would have a category, and an answer would have a responseID that equaled the questions QAID.
This would grab ALL questions:
SELECT * FROM tblQA WHERE category IS NOT NULL
This would grab all answers:
SELECT * FROM tblQA WHERE ResponseID IS NOT NULL