<?php
    include 'db_conn.php';

    $stmt = $db->prepare('SELECT time, message FROM chat ORDER BY time DESC;');
    $stmt->execute();
    $results = $stmt->fetchAll(PDO::FETCH_ASSOC);

    foreach($results as $result)
    {
        $time = strftime('%H:%M', strtotime($result['time']));
        echo "<span class='bold'>{$time}</span> <span class='message'>{$result['message']}</span><br/>";
    }
?>
