From 3aef9df655569a1bba7a75fe17aebd1ec6dfd40f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alexander=20Nicolaysen=20S=C3=B8rnes?= Date: Sat, 10 Nov 2007 19:19:23 +0100 Subject: [PATCH] comment: Show newest threads first --- include/comment.php | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/include/comment.php b/include/comment.php index 0a85529..38d419e 100644 --- a/include/comment.php +++ b/include/comment.php @@ -294,15 +294,21 @@ class Comment { $sExtra = ""; + $sOrderingMode = "DESC"; + /* NOTE: we must compare against NULL here because $iParentId of 0 is valid */ - if($iParentId != NULL) + if($iParentId) + { $sExtra = "AND parentId = '".$iParentId."' "; + $sOrderingMode = "ASC"; + } $sQuery = "SELECT from_unixtime(unix_timestamp(appComments.time), \"%W %M %D %Y, %k:%i\") as time, ". "appComments.commentId, appComments.parentId, appComments.versionId, appComments.userId, appComments.subject, appComments.body, appVersion.appId ". "FROM appComments, appVersion WHERE appComments.versionId = appVersion.versionId AND appComments.versionId = '".$iVersionId."' ". $sExtra. - "ORDER BY appComments.time ASC"; + "ORDER BY appComments.time $sOrderingMode"; + $hResult = query_appdb($sQuery); return $hResult;