Re: threaded forum to display replies

From: Date: Thu, 13 Sep 2001 20:07:21 +0000
Subject: Re: threaded forum to display replies
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-67266@lists.php.net to get a copy of this message
How about something like this: <? if (!isset($parent)) { $parent = "1"; } function showmessage($parent) { // REcursive function to display messages global $db; $sql = "SELECT * FROM sites WHERE parentID='$site'"; $r = mysql_query($sql, $db); echo "<ul>\n"; if ($r) { while ($row=mysql_fetch_array($r)) { // output your message here - it'll appear // in a nested list structure with the existing // html code. showmessage($row['ID']); } } echo "</ul>"; } showmessage($parent); ?> hassan xaaji wrote: > I cannot show all the replies in a threaded way. I > tried a recursive method which takes the messageid and > I do like > $messageID = $p_id +1; > showMessages($messageID); > > This only works if the messageids are 1 2 3 4 5 6. but > if two consecutive messages have messages ids like 13 > and 15 or 14 and 20 for example, this does not work. > Please help me here. -- Chris Hobbs Silver Valley Unified School District Head geek: Technology Services Coordinator webmaster: http://www.silvervalley.k12.ca.us/~chobbs/ postmaster: chobbs@silvervalley.k12.ca.us

« previous php.general (#67266) next »