Organize Questions & Answers from database in php and mysql

fatehdashti

New Member
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 = postIDI'd like to write some php code that would display the data in the following format:Question:
- answer
- answer
- answerQuestion:
- answer
- answer
- answer...and so onAdditional 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 NULLThis would grab all answers:
SELECT * FROM tblQA WHERE ResponseID IS NOT NULL
 
Back
Top