Location: PHPKode > scripts > WH Social > wh_social/modules/latest.inc.php
<?php

    $sql = "SELECT
                topics.id AS topID,
                topics.subject,
                topics.views,
                discussions.id AS discID,
                discussions.content,
                discussions.topic,
                discussions.date AS discDATE,
                discussions.author,
                members.id AS memID,
				members.name
            FROM
                topics
            LEFT JOIN
				discussions
			ON
				discussions.topic = topics.id
			LEFT JOIN
				members
			ON
				discussions.author = members.id
            ORDER BY
                discDATE DESC
            LIMIT
                3";

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

    if(!$result) {

    echo '<p>' . $lang['no_topics'] . '</p>' . mysql_error();

        }else{

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

        echo '<p>' . $lang['no_topics'] . '</p>' . mysql_error();

    }else{

    include_once('framework/functions/wordcut.php');
    include_once('framework/filter.php');
    include_once('framework/functions/badwords.php');
    include_once('framework/functions/smileys.php');

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

        echo '<table width="100%" cellpadding="5" cellspacing="0" class="guestbook">
        <tr>
        <td><h2>' . htmlentities($row['subject'], ENT_QUOTES) . '</h2>
        <a href="member.php?id=' . (int)$row['memID'] . '">' . htmlentities($row['name'], ENT_QUOTES) . '</a><br>
        <small>' . date('d.m.Y - H:i', strtotime($row['discDATE'])) . ' ' . $lang['o_clock'] . '</small>
        <p>';

        $id_disc = (int)$row['discID'];
        $text = mysql_filter(filter_html(badwords(smileys(stripslashes(nl2br($row['content']))))));

        echo wordCut($text, 350);

        echo '...<br><br><a href="read_discussion.php?id=' . (int)$row['topID'] . '">[' . $lang['read_more_text'] . ']</a></p></td>
        </tr>
        </table>';
        }
    }
    }

?>
Return current item: WH Social