Good morning,
I have been agonizing over this, what feels like forever. I am thissss close! I have one more peice I can’t seem to make work. Using the code below I get all the Facilities in a list then the table as one big table. What I WANT is the facility the table data associated with that facility then start another table list the facility name then table data associated with that facility repeating the process until there are no more facilities.
Can anyone help me!!! Thanks in advance.
Laura
[CODE]
// first set some basic vars:
$label = “”;
$type = ”;
$data = “”;
$allocation = ”;
$diff = ”;
include (“UpLoad/connect.php”);
//load it all into the associative array
$sql = “select * from dbo.vwAllByFacility”;
$result = mssql_query($sql);
echo $type;
echo “<table border=1>”;
while($row = mssql_fetch_row($result))
{
if($row[1] <> $label)
{
if($allocation != ”)
{
echo $allocation;
}
if($diff != ”)
{
echo $diff;
}
if($type != ”)
{
echo $type;
}
//header row
echo “<TR class =dkblue>
<th class=header>”.$row[1].”</td></tr>”;
$label = $row[1];
//facility name
$type = “Facility: “.$row[0];
//allocations row
$allocation = “<tr class=blue>”.
“<td>Allocation</td>”.
“<td>$row[23]</td>”.
“</tr>”;
//difference row
$diff = “<tr class=blue>”.
“<td>Difference</td>”.
“<td>$row[41]</td>”.
“</tr>”;
}
//data row
echo “<tr class=tr>
<td>$row[2]</td>
<td>$row[3]</TD>
</tr>”;
}
echo $allocation;
echo $diff;
echo “</table><br>”;