Beispiel #1
0
function getRecentComments()
{
    /*
        Queries the database for the top 3 highest IDs in comments
    */
    global $con;
    try {
        $sql = "SELECT `comment`, username, `id`, `title`, `title_id` FROM `comments` ORDER BY `id` DESC LIMIT 3";
        $sql = $con->prepare($sql);
        $sql->execute();
        buildRecentComments($sql->fetchAll());
    } catch (PDOException $e) {
        echo $e;
    }
}
Beispiel #2
0
            <div class="panel-heading">
                <h3>Trending Titles</h3>
            </div>
            <?php 
getTrendingTitles();
?>
        </div>
    </div>
    <div class="row">
        <div class="col-xs-6 col-md-4">
            <div class="panel panel-primary">
                <div class="panel-heading">
                    <h4>Recent Comments</h4>
                </div>
                <?php 
buildRecentComments(getRecentComments());
?>
            </div>
        </div>
    </div>
    <div class="row">
        <?php 
if (isset($_SESSION['loggedin'])) {
    ?>
        <div class="col-xs-6 col-md-4">
            <div class="panel panel-primary">
                <div class="panel-heading">
                    <h4>Your Favorites</h4>
                </div>
                <?php 
    buildFavorites(getFavorites($_SESSION['username']));