justlukeyou Posted March 8, 2011 Share Posted March 8, 2011 Hi, I am in the procress of creating discussion system however I am a bit puzzled about the best way to go about it. I am starting the discussion by creating an ID number and then match the answer to the initial ID number. However, I dont know whether if is best to put the responses into a different database. I'm a bit puzzled how ID matching systems works. Lets say: Question 1 = ID1 Question 2 = ID2 Question 3 = ID3 Question 1 Answer 1 = ID4 (How is this matched to ID1) Question 2 Answer 1 = ID5 (How is this matched to ID2) is this based on preg_match? Quote Link to comment https://forums.phpfreaks.com/topic/230031-id-matching-databases/ Share on other sites More sharing options...
trq Posted March 9, 2011 Share Posted March 9, 2011 The basic gist is: Questions and answers need a parent_id field. Questions have a parent_id of 0 while answers have a parent_id that matches there related question's ID. Quote Link to comment https://forums.phpfreaks.com/topic/230031-id-matching-databases/#findComment-1184877 Share on other sites More sharing options...
justlukeyou Posted March 9, 2011 Author Share Posted March 9, 2011 Thanks, This sound VERY complicated. I was planning on adding an ID number to each question and then linking the answer to the relevant ID. How does this process link it? What if two people submit exactly the same question if the ID number is always 0? Quote Link to comment https://forums.phpfreaks.com/topic/230031-id-matching-databases/#findComment-1184922 Share on other sites More sharing options...
justlukeyou Posted March 9, 2011 Author Share Posted March 9, 2011 Hi, Can I do it like this: Create a Question ID (QID) with the question in 'QuestionsTable' and then when someone answers the questions I put the Answer QID and answer next to an Answer ID (AID) into a table called "AnswersTable" and that should mach the Question with the Answer by using two tables. Quote Link to comment https://forums.phpfreaks.com/topic/230031-id-matching-databases/#findComment-1184925 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.