PHP קוד:
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"];
$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"];
echo "<b>$cat_name</b><br>";
$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 "$forum_name<br>";
}
}