if you want a relation for let's say a forum, you have a parent record (i.e. the first post in a thread).
All of the following records are childs. In the most basic way I can think of you need 3 collums:
-ID
-text
-parent-ID
now, for the first record you add the ID in the parent-id field as well (you can use the
insert_id() function to gather the id of the just inserted record).
If a user posts a reply, you need to know on which ID he is replying (can be done using a hidden input-field):
you must add something like that to your form, don't forget to set the correct value (instead of "3" you must enter the actual ID).
Then, you enter a new record and set the parent ID.
At the end you can do something like:
to show all posts to a certain thread.
your db-records would look like that:
I hope that was somehow understandable...