Re: Detailed Report
| From: | Adrian Bruce | Date: | Thu, 27 Oct 2005 09:49:28 +0000 |
| Subject: | Re: Detailed Report | ||
| References: | 1 2 3 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-224718@lists.php.net to get a copy of this message | ||
ok, so i assume that customers is a grouping of some sort and that in some cases you may come accross a row like "Staff | John | A36 |LA ". It may not be a perfect way of doinig it but this is what i would generally try:
while ($row = mysql_fetch_array($resultset, MYSQL_NUM)){
if($row[0] == $group){
echo" $row[1] | $row[2]"; }
else{
echo"$row[0]<br/><br/>$row[1] | $row[2] | $row[3]";
}
$group = $row[0];
}
Ade
Danny wrote:
Thanks for your help Adrian, but the problem is that I need to show row[0] once (Customers text are repeated), and below the details of the records Your solution shows: Customers | John | A36 | New York Customers | Jason | B45 | Los Angeles (...) And I need Customers<BR> John | A36 | New York Jason | B45 | Los Angeles (...) (...) On 10/27/05, *Adrian Bruce* <abruce@stvincent.ac.uk <mailto:abruce@stvincent.ac.uk>> wrote:load each row of the resultset into an array $row using mysql_fetch_array(), each field in the result set row will be held in the corresponding array element.while ($row = mysql_fetch_array($resultset, MYSQL_NUM)){ echo"$row[0] | $row[1] | $row[2]"; }Hope this helps, AdeDanny wrote: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 General Mailing List ( http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php-- dpc