I have a db table with student room assignments. Each student has a specific hall, floor, and apartment. I need to display each student in a specific table so the results look like a floor layout. Below is an example.
[ATTACH]15665[/ATTACH]
Here is what I started with, but all the results are just listed down the page. Any help would be great.
$query = "SELECT res.ID, res.APARTMENT
FROM Residents res
WHERE res.ROOM_ASSIGN_STS = 'A'
and res.BLDG_CDE = '$pulledhall'
and res.FLOOR = '$pulledfloor'";
$result = odbc_exec($connect, $query);
while(odbc_fetch_row($result)){
$ID = odbc_result($result,ID);
$APARTMENT = odbc_result($result,APARTMENT);
if ($APARTMENT == $pulledfloor.'01')
{
echo "<table>";
echo $pulledfloor.'01';
echo "<tr><td>";
print $ID;
echo "</td></tr>";
echo "</table>";
}
else if ($APARTMENT == $pulledfloor.'02')
{
echo "<table>";
echo $pulledfloor.'02';
echo "<tr><td>";
print $ID;
echo "</td></tr>";
echo "</table>";
}
else if ($APARTMENT == $pulledfloor.'03')
{
echo "<table>";
echo $pulledfloor.'03';
echo "<tr><td>";
print $ID;
echo "</td></tr>";
echo "</table>";
}
else if ($APARTMENT == $pulledfloor.'04')
{
echo "<table>";
echo $pulledfloor.'04';
echo "<tr><td>";
print $ID;
echo "</td></tr>";
echo "</table>";
}
else if ($APARTMENT == $pulledfloor.'05')
{
echo "<table>";
echo $pulledfloor.'05';
echo "<tr><td>";
print $ID;
echo "</td></tr>";
echo "</table>";
}
else if ($APARTMENT == $pulledfloor.'06')
{
echo "<table>";
echo $pulledfloor.'06';
echo "<tr><td>";
print $ID;
echo "</td></tr>";
echo "</table>";
}
}
The attachments of this post were removed during the platform migration in 2018