I am new to CI.
Now i am try to develop the comment system with reply option.
So far i have developed the insert comment and reply comment.
But i don’t know how to fetch reply comments under the main comment.
Please help me.
Thanks to all
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Use a recursive function! For that you will need to do something like this:
A pseudo-code of this schema will be:
In the pseudo-code, I’m assuming that you get a row_array with the getComment() function & that this comment is the “head” of all the comments, like the initial post.
After that, I call the recursive function which gets all the replies & sub-replies for each comment. Note the I fetch a single reply in each call to the function.
Hope this gives you an idea! (=