guestbook/fetch-sql.php

20 lines
500 B
PHP
Raw Permalink Normal View History

<?php
$dbh = new PDO('sqlite:/home/evan/Development/Website-Redesign/static/guestbook/database.sq3');
$data = $dbh->query('SELECT * FROM messages')->fetchAll();
rsort($data);
foreach($data as $post) {
echo '<section class="guestbookpost">';
echo "<h4>";
echo $post["name"] . "<br>";
echo "</h4>";
echo '<h4 class="date">';
echo $post["date"] . "<br>";
echo "</h4>";
echo "<p>";
echo $post["message"] . "<br>";
echo "</p>";
echo "</section>";
}
echo "</div>";
?>