תלמד לתכנת :-|
בכל מקרה:
PHP קוד:
<table cellpadding=\"4\" cellspacing=\"1\" border=\"1\" bordercolor=\"$bordercolor\" width=\"95%\" align=\"center\">
<?
categories = mysql_query("select * from forums_cats order by id desc");
while(@($cat=mysql_fetch_array($categories))) {
$cat_id = $cat["id"];
$cat_name = $cat["name"];
echo "<tr align=\"center\">
<td width=\"100%\" class=\"title\"><b>". $cat_name . "</b></td>
</tr>
<tr align=\"center\">
<td class=\"title\"> </td>
<td align=\"right\" class=\"title\">פורום</td>
<td class=\"title\">הודעה אחרונה</td>
<td class=\"title\">אשכולות</td>
<td class=\"title\">הודעות</td>
</tr>";
$sql = mysql_query("SELECT * FROM forums WHERE forum_cat='$cat_id' ORDER BY forum_order") or die(sqlerror(__LINE__));
while(@($row=mysql_fetch_array($sql))) {
$forum_id = $row["forum_id"];
$forum_name = $row["forum_name"];
$forum_desc = $row["forum_desc"];
$forum_icon = $row["forum_icon"];
$topics_count = $row["topics_count"];
$posts_count = $row["posts_count"];
$last_post = mysql_query("SELECT * FROM topics WHERE forum_id='$forum_id' ORDER BY topic_id DESC") or die(sqlerror(__LINE__));
$l = mysql_fetch_array($last_post);
$topic_last_post_name = $l["topic_last_post_name"];
$topic_last_post_time = $l["topic_last_post_time"];
$n = mysql_num_rows($last_post);
$user_query = mysql_query("SELECT * FROM users WHERE username='$topic_last_post_name'") or die(sqlerror(__LINE__));
$u = mysql_fetch_array($user_query);
$poster_id = $u["id"];
if($topic_last_post_name == "admin") { $topic_last_post_name = "<font color='red'>Admin</font>"; }
if($n == "") { $topic_last_post_time = ""; }
if($n == "") { $topic_last_post_name = "àó ôòí"; }
if($forum_icon == ""){
$icon = " ";
}
else {
$icon = "<img src=\"images/icons/$forum_icon\" border=\"0\">";
}
echo " <tr align=\"center\">
<td>$icon</td>
<td align=\"right\"><a href=\"index.php?act=forums&op=showforum&id=$forum_id\">$forum_name</a><br>$forum_desc</td>
<td><a href=\"index.php?act=profile&id=$poster_id\">$topic_last_post_name</a><br>$topic_last_post_time</td>
<td>$topics_count</td>
<td>$posts_count</td>
</tr>";
}
}
</table>
</div>
</div>
קוד יותר לא יעיל מזה לא תמצא בשוק.