From 22588626f201a5f13435303f14a0d221c725387e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Zden=C4=9Bk=20Borovec?= Date: Mon, 29 Apr 2024 01:38:42 +0200 Subject: [PATCH] comment ordering and timestamp format change --- docs/www/blog/article.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/docs/www/blog/article.php b/docs/www/blog/article.php index f08ea05..7dc9f67 100644 --- a/docs/www/blog/article.php +++ b/docs/www/blog/article.php @@ -35,7 +35,7 @@ class BlogpostComment
- ", $this->poster_name, date("Y-m-d", strtotime($this->timestamp)), + ", $this->poster_name, date("Y-m-d H:i", strtotime($this->timestamp)), $this->content); if($this->children != null) { @@ -56,7 +56,7 @@ class BlogpostComment $stmt = $conn->prepare("SELECT comment_id, poster_id, timestamp, content, username FROM (blogpost_comments INNER JOIN users ON poster_id = user_id) WHERE blogpost_id = :blogpost_id - AND parent_id = :comment_id;"); + AND parent_id = :comment_id ORDER BY timestamp ASC;"); // Bind and execute the comment select $stmt->bindParam(":blogpost_id", $this->blogpost_id); @@ -196,7 +196,7 @@ function load_comments($conn, $blogId) { $stmt = $conn->prepare("SELECT comment_id, poster_id, timestamp, content, username FROM (blogpost_comments INNER JOIN users ON poster_id = user_id) WHERE blogpost_id = :blogpost_id AND - parent_id IS NULL;"); + parent_id IS NULL ORDER BY timestamp ASC;"); // Bind and execute the comment select $stmt->bindParam(":blogpost_id", $blogId);