Thanx Chris, this works. Here is the code (might help somebody else)


unset($previousDate);


for ($i=0; $i < $num_results; $i++){

        if($previousDate != $log['date'][$i])
                echo '<b>'.$log[date][$i].'</b>'.$p.'<ul>';

echo '<li>'.$log[entry][$i].'</li>';

        $previousDate = $log['date'][$i];
        if($previousDate != $log['date'][$i+1]){
                echo '</ul>';             
        }
}



Chris W. Parker wrote:
Merlin <mailto:[EMAIL PROTECTED]>
    on Friday, August 29, 2003 3:03 PM said:


Unfortuantelley this looks way more complicated than I thought. How to
group by date and still get the entry, and how can I arange it, that
it outputs only the one for the date and then closes the list`?


To display the output like you've got in your post you'd do something
like this:

(pseudo code)

$arrayOfEntries = GetEntries();

$previousDate = "";
foreach($arrayOfEntries as $entry)
{
        if($previousDate != $entry['date'])
        {
                // show date header
                // show comment for this record
        }
        else
        {
                // show comment only
        }

        $previousDate = $entry['date'];
}


Let me know if this helps (and if it doesn't too).


Chris.

-- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php



Reply via email to