Hi Rudi,

> I've done this before in coldfusion.
> It's the one thing I'm note sure on how to do the same(ish)
> in PHP - my language of choice.
> If we have the record set the CF code would look like
>
> <ul>
> <cfoutput query="customers> group="zip"> <!--- loop through record set --->
> <li>#zip#
> <ol>
> <cfoutput> <!--- inner loop on group by zip --->
> <li>#customer#
> </cfoutput>
> </ol>
> </cfoutput>
> </ul>
>
> So I'm think also to use 2 loops for the same purpose in PHP.
> Can I do this from the record set like above or do I need
> to build array's I wonder ?


No need for arrays - the resultset from the RDBMS effectively is one - SQL-talk says 
it's a table (please show
us your SQL query if you have any doubt about this). Make sure the SQL resultset is 
sorted/grouped correctly!

You're approach looks right to me - just more CF than PHP-like. How's this?


query RDBMS
check result ok/have at least one row
extract first row
initiate presentation

WHILE not EoD
  note zip code
  ECHO zip heading

  WHILE this row's zip == noted zip AND not EoD
    ECHO customer data
  end while zip

  extract next row from resultset
end while data

terminate presentation


OK?
Regards,
=dn



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

Reply via email to