Afternoon,
I'm almost there. Except I want it to group by one field first then by another.
Right now it groups by classification. I want it to group by Status first THEN classification. Can anyone point me in the right direction?
Thanks so much.
<?
include("UpLoad/connect.php");
//load it all into the associative array
$sql = "SELECT Classification,
case when status = 'Off Rent' then 'Do Not Use'
else Status end as Status,
TrailerID,Specialty,CargoType,BodyType,Length,DoorType,OwnershipType,Description,
Location,Contents,Comments,UpLoadTime
from Yardcheck.dbo.vwCountDailyYC
where Source = 'North Hatfield'
and UpLoadDate= '04/28/2005'
and AMPM='AM'
order by CargoType,Length DESC";
$result = mssql_query($sql);
echo "<center>Daily AM Yard Check--- North Hatfield<p>";
echo date("l") ;
echo "---";
echo date("m/d/Y") ."</center>";
echo "<table border='1'>";
while($row = mssql_fetch_row($result))
{
$total = mssql_num_rows($result);
$myArray[$row[0]] = $row[1];
//now we expand it
while(list($Classification,$Status) = each($myArray))
{
echo "<tr><th colspan=4><b>$Classification Trailers</b></td></tr>";
}
echo "<tr>";
echo "<td>$row[1]</td>";
echo "<td>$row[2]</td>";
echo "<td>$row[3]</td>";
echo "<td>$row[4]</td>";
echo "<td>$row[5]</td>";
echo "<td>$row[6]</td>";
echo "<td>$row[7]</td>";
echo "<td>$row[8]</td>";
echo "<td>$row[9]</td>";
echo "<td>$row[10]</td>";
echo "<td>$row[11]</td>";
echo "<td>$row[12]</td>";
echo "<td>$row[13]</td>";
echo "</tr>";
}
echo "</table>";
echo "Total Trailers: ". mssql_num_rows($result);
?>