Hi, first post here. I'm wanting to create a php script which will call itself in a recursive function so that nested comments are made ..
An example of a perfect hierarchy would be as bellow...
Comment #1
-- Comment reply
--- Comment reply
--- Comment reply
------ Comment reply
-------- Comment reply
---------- Comment reply
--- Comment reply
--- Comment reply
Comment #2
-- Comment reply
------ Comment repl
Don't use "SELECT * ". Specify the columns you want. This makes it easier for others, like me, to understand what is in the table and what the query is doing.
Indent your code to show the nested structure of loops etc.
If you had done those I might have given this problem more than a cursory glance. So you'll have to settle for a generic example of using a recursive function to give an indented list of parent/child elements.
Also,
Don't run queries inside loops. Use JOINs