Hi,
Thanks for the input,
I'll stop messing around and post some code
Be warned this code is untested :-)
It's kinda like thinking out loud.
I think this should produce a nested list output from a query.

Given this query :
SELECT count(zip) AS zipcount,zip,cust_last_name 
FROM customers
GROUP BY zip
ORDER BY zip,cust_last_name;

My php code might look like : ( for Postgresql )

$thiszip = pg_result($res,0,0); // the first zip code in the record set
echo "<ul>"; // open main list

for ( $i=0; $i<=pg_numrows($res); ++$i ) // begin loop over record set
{
if ( pg_result($res,$i,0) != $thiszip ) // if this zip is the same as the last
{
if ( $thiszip != "no_zip_yet" ) // if this is true we have an open ol list
    { echo "</ol>";}
echo "<li>".pg_result($res,$i,0); // output zip code
echo "<ol>"; // open inner list
echo "<li>".pg_result($res,$i,1); // output customer data
$thiszip = pg_result($res,$i,0); // track current zip
}
else // zip is same as last one
{
echo "<li>".pg_result($res,$i,1); // output customer data
}
} // finish loop.
echo "</ul>"; // close main list.

What do you think ?
I'll test it tomorrow at work.
I'll let you know how she goes.
Thanks for your time, suggestions and attention.
Much appreciated.
Regards
Rudi.


=============================================================
 Get your personalised email and homepage at www.easymail.info

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

Reply via email to