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:               [EMAIL PROTECTED]

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to