Location: PHPKode > scripts > WH Board > wh_board/modules/latest_topics.php
<?php

    $count = mysql_query("SELECT topic_id FROM topics") OR die(mysql_error());
    include('framework/navigation.php');

    $sql = "SELECT
    		    topics.topic_id,
    		    topics.topic_subject,
    		    topics.topic_date,
    		    topics.topic_cat,
    		    topics.topic_by,
    		    topics.topic_views,
    		    categories.cat_id,
				categories.cat_name,
				users.user_id,
				users.user_name
    	    FROM
    		    topics
    		LEFT JOIN
			    categories
			ON
				topics.topic_cat = categories.cat_id
			LEFT JOIN
			    users
			ON
				topics.topic_by = users.user_id
    	    ORDER BY
    		    topic_id DESC
            LIMIT
                $start,$entries";

    $topics = mysql_query($sql) OR die(mysql_error());

    if(!$topics) {

    echo '<p class="false">' . $lang['no_available_topics'] . '</p>' . mysql_error();

        }else{

        if(intval(mysql_num_rows($topics)) == 0) {

        echo '<p class="false">' . $lang['no_available_topics'] . '</p>';

    }else{

    while($row = mysql_fetch_assoc($topics)) {

        $actual = (int)$row['topic_id'];

        echo '<h2 class="ribbon">' . date('d.m.Y', strtotime($row['topic_date'])) . '</h2>';

        echo '<div class="topic_preview">
                  <div class="topic_preview_avatar">
                      <img src="style/images/grafics/avatar.png" border="0" alt="Avatar">
                  </div>

                  <div class="topic_preview_content">
                      <a href="topic.php?id=' . (int)$row['topic_id'] . '" class="topic_link">' . htmlentities($row['topic_subject'], ENT_QUOTES) . '</a>
                      <p class="topic_link">Views: ' . (int)$row['topic_views'] . '&nbsp;&nbsp;&nbsp;&nbsp;' . $lang['posts'] . ': ';

              $allrep = mysql_query("SELECT post_id FROM posts WHERE post_topic = " . (int)$row['topic_id'] . "");
              $replies = intval(mysql_num_rows($allrep));

        echo (int)$replies;

        echo '&nbsp;&nbsp;&nbsp;&nbsp;' . $lang['by'] . ': <a href="profile.php?user_id=' . (int)$row['user_id'] . '" class="topics">' . htmlentities($row['user_name'], ENT_QUOTES) . '</a>
        &nbsp;&nbsp;&nbsp;&nbsp;' . $lang['one_category'] . ': <a href="category.php?id=' . (int)$row['cat_id'] . '" class="topics">' . htmlentities($row['cat_name'], ENT_QUOTES) . '</a>
        <img src="style/images/notification/dot.png" border="0" hspace="10" alt="Separator"> ' . $lang['last_post'] . ': ';

        include('modules/latest_posts.php');
        echo '' . $lastpost . '</p></div>
        </div>
        <div id="betline">&nbsp;</div>';
        }

        echo '<div class="top_topics"><a href="favorites.php" class="quickbutton">' . $lang['favourite_topics'] . '</a></div>
        <div class="nav_buttons"><a href="index.php#top"><img src="style/images/notification/top.png" hspace="2" alt="Nach oben" border="0"></a>
        <a href="feeds/rss.php" target="_blank"><img src="style/images/notification/rss.png" alt="RSS Feeds" border="0"></a></div>';
        }
    }

?>
Return current item: WH Board