This seperates the two HTML fetches to fetch-sql.php and fetch-json.php, this even means I could use both, or even provide an option to select between the submisson types. I think that however would be too much for me to maintain, so I will only use one or another. I do want to work on the datatype, and using .ini configuration for SQL and for selecting the datatype by default. If there are optimzations I can make to my SQL querys, I will try to implment those, however I know of none such optimzations.
19 lines
500 B
PHP
19 lines
500 B
PHP
<?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>";
|
|
?>
|