comment: Show newest threads first

This commit is contained in:
Alexander Nicolaysen Sørnes
2007-11-10 19:19:23 +01:00
committed by Chris Morgan
parent da4b3f638d
commit 3aef9df655

View File

@@ -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;