Good Morning,
I am really close here, but can't quite get it. What I need to have happen is a table is created for every facility within that table the results are grouped again so the header is bodytype like so:
(begin table) ------------------- (begin next table)
Aberdeen ----------------- Brattleboro
Drybox ------------------------ Drybox
some data ------------------------- some data
Refrigerated -----------------------Refrigerated
some data---------------------------- some data
SPecial ------------------------------SPecial
some data --------------------------- some data
(end table)-----------------------------(end table)
and so on until you run out of facilities.
What I get with the code below is almost there but not quite (It's slimmed down alot so you can see where the brackets lie):
(begin table) -----------------------(begin next table)
Aberdeen-------------------Brattleboro
Drybox ---------------------------------Drybox
some data-------------------------------some data
Aberdeen------------------Brattleboro
Refrigerated---------------------------Refrigerated
some data----------------------------some data
Aberdeen-------------------Brattleboro
SPecial-----------------------------------SPecial
some data---------------------------------some data
(end table)------------------------------(end table)
// first set some basic vars:
$label = "";
$data = "";
$allocation = '';
$diff = '';
include ("UpLoad/connect.php");
//load it all into the associative array
$sql = "select * from dbo.vwAllByFacility";
$result = mssql_query($sql);
echo "<table border=1>";
while($row = mssql_fetch_row($result))
{
if($row[1] <> $label)
{
if($allocation != '')
{
echo $allocation;
}
if($diff != '')
{
echo $diff;
}
//header row
$label = $row[1];
//allocations row
$allocation = "";
//difference row
$diff = "";
}
//data row
}
echo $allocation;
echo $diff;
echo "</table><br>";
Any thoughts or suggestions would be most welcome.
Laura