Let the code handle the separation of the products <?php $sql = "select * from table [where clause] order by cat"; //db connection here $result = mysql_query($sql); if (mysql_errno == 0) { if (mysql_num_rows($results)>0) { $old_cat = ""; while ($rows = mysql_fetch_array($result)) { //handle cat changes if ($old_cat != $rows['cat']) { echo "<tr><td>".$rows['cat']."<br />"; $old_cat = $rows['cat']; }//end if //echo out the data echo $rows['name']."~".$rows['client_id']."~".$rows['city']."<br / >" }//wend }else{ echo "no results found"; }//end if }//end if ?> bastien
From: Danny <metalito@xxxxxxxxx> To: php-db@xxxxxxxxxxxxx Subject: Detailed Report Date: Thu, 27 Oct 2005 11:32:04 +0200 Hi All, I´ve got a connection, to a MySQL db, and get the following ResultSet(Category | Name | Code | City) Customers | John | A36 | New York Customers | Jason | B45 | Los Angeles Customers | Max | A36 | Paris Providers | John | A36 | London Providers | Mark | B67 | Madrid And I need the report in the following format: Customers John - A36 - New York Jason - B45 - Los Angeles Max - A36 - Paris Providers John - A36 - London Mark - B67 - Madrid Any one can help? I´m a bit stalled thx regards.
-- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php