Ok, I've been working on a project and I have the hard part almost done (everything else is easy). And I have made a function and tested it out, but it will cut off the first and last DB entries. So here's the code:
<pre>
<?php
$dbhost = "localhost";
$dbuser = "admin";
$dbpass = "";
mysql_connect($dbhost,$dbuser,$dbpass);
function floor_table($floor)
{
mysql_select_db("einet");
$result=mysql_query("SELECT * FROM einet WHERE floor=$floor");?>
<table width="100%" border="0" cellspacing="0" cellpadding="1">
<tr>
<td bgcolor="#000000">
<table width="100%" border="0" cellspacing="0" cellpadding="1">
<tr bgcolor="#0099CC">
<td colspan="4"><font size="5">Floor <?php echo $floor;?></font></td>
</tr>
<?php
while ($row = mysql_fetch_array($result))
{
echo "<tr bgcolor=\"#FFFFFF\">\n";
for($cnt=0;$cnt<=3;$cnt++)
{
while ($row = mysql_fetch_array($result))
{
echo "<td>".$row["room"]." (<a href=\"blah\">off</a>)</td>\n";
break;
}
}
echo "</tr>\n";
}
echo "</table>\n";
}
floor_table(1);
?>
</pre>