tags:

views:

59

answers:

1

I have a result set like this :

Platform   Set   Total
WinY1-23   OT    12
WinY1-23   TT    22
WinY1-23   OR    13
WinY1-23   OY    142
Total_WS   OT    12
Total_WS   TT    12
Total_WS   OR    13

Basically this is a query with group by Platform, Set. I want to be able to display each Set and its total within each Platform. Hope this makes sense. Is there any way to display just once the Platform and the Sets under it? In SSRS we can show something similar , as the report displays + sign for each of this Platform type. Can we do this in PHP? or by any other means?

Thanks.

+1  A: 

Asssuming what you want is something like this:

$platform = '';
foreach($resultSetArray as $row){
  // if platform is different from previous one
  // display platform
  if($row['platform'] != $platform){
    echo $row['platform'];
    $platform = $row['platform'];
  }

  echo $row['otherStuff'];
}


WinY1-23   
OT    12
TT    22
OR    13
OY    142
Total_WS
OT    12
TT    12
OR    13
Sinan
thank you very much . This is exactly what I was looking for.
JPro