Okay, this code is supposed to reprsent dynamic pages and organize them according to what menu box they are supposed to be under. currently it organizes the info like this:
--projects---
new
--projects---
old
--projects--
etc.
where i want it to be formatted like this:
--projects--
new
old
etc.
I know this is because of the inner join, but this piece of code is going to be present on multiple pages (by using it in an include(); ) so i want it to be as efficient as possible because many people will be viewing this at once...
Any suggestions how to do this effieciently and effectivley?
current code:
<?php
$link = mysql_connect("localhost", "username", "pass") or die("Could not connect to database");
mysql_select_db("ma", $link) or die("Could not select database");
$result = mysql_query("SELECT hall.*, room.* FROM hall INNER JOIN room WHERE hall.hallname = room.hallname", $link) or die (mysql_error());
$i = mysql_num_rows($result);
while($i >0)
{
--$i;
list($hid, $hallname, $rid, $hallroomname, $roomname, $date) = mysql_fetch_row($result);
?>
<!-----template hall---------->
<table border="0" cellspacing="0" cellpadding="0" width="150">
<tr>
<td bgcolor="#000000" >
<table width="150" border="0" cellspacing="1" cellpadding="0">
<tr>
<td valign="top" bgcolor="#123456"><IMG SRC="/mypage/images/topleft02.gif" WIDTH="15" HEIGHT="15" ALIGN="absmiddle"></IMG> <font color="#FFFF00"><b><?php echo $hallname; ?></b></font></td>
</tr>
<tr>
<td bgcolor="#47515f"><font face="verdana,arial,helvetica" size="1" class="sf">
<strong><big>ยท</big></strong> <a href="/mypage/room.php?rid=<?php echo $rid; ?>"><?php echo $roomname; ?></a><br>
</font>
</td>
</tr>
</td>
</table>
</tr>
</table>
<!------/template hall---------->
<br>
<?php
}// end template loop
mysql_free_result($result);
mysql_close();
?>
oh yes, the table "hall" has columns hid and hallname. table "room" has columns rid, hallname, roomname, date, author and content. hall.hallname and room.hallname will the the same where it should be under the hall menubox type thing...
I"m sorry if this is all very confusing. its very late ๐
Any and all help is appreciated. Thanks
-emrys