';
+ echo "";
+ echo $post["name"] . "
";
+ echo "
";
+ echo '';
+ echo $post["date"] . "
";
+ echo "
";
+ echo "";
+ echo $post["message"] . "
";
+ echo "
";
+ echo "";
+ }
+ echo "";
+?>
diff --git a/fetch-sql.php b/fetch-sql.php
new file mode 100644
index 0000000..c7bbcec
--- /dev/null
+++ b/fetch-sql.php
@@ -0,0 +1,19 @@
+query('SELECT * FROM messages')->fetchAll();
+rsort($data);
+foreach($data as $post) {
+ echo '';
+ echo "";
+ echo $post["name"] . "
";
+ echo "
";
+ echo '';
+ echo $post["date"] . "
";
+ echo "
";
+ echo "";
+ echo $post["message"] . "
";
+ echo "
";
+ echo "";
+ }
+ echo "";
+?>
diff --git a/index.html b/index.html
index c491c2f..1dfb184 100644
--- a/index.html
+++ b/index.html
@@ -22,23 +22,7 @@
';
- echo "";
- echo $post["name"] . "
";
- echo "
";
- echo '';
- echo $post["date"] . "
";
- echo "
";
- echo "";
- echo $post["message"] . "
";
- echo "
";
- echo "";
- }
- echo "";
-
+ include("fetch-sql.php");
?>