From b87fd00a62994d24a3708cec5f5613ed2e9a67ed Mon Sep 17 00:00:00 2001 From: xue <> Date: Tue, 30 May 2006 21:26:29 +0000 Subject: merge from 3.0 branch till 1111. --- demos/blog/protected/Common/BlogDataModule.php | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) (limited to 'demos/blog/protected/Common/BlogDataModule.php') diff --git a/demos/blog/protected/Common/BlogDataModule.php b/demos/blog/protected/Common/BlogDataModule.php index a15701ab..3dc71989 100644 --- a/demos/blog/protected/Common/BlogDataModule.php +++ b/demos/blog/protected/Common/BlogDataModule.php @@ -341,9 +341,22 @@ class BlogDataModule extends TModule return $commentRecord; } + public function queryComments($filter,$orderBy,$limit) + { + if($filter!=='') + $filter='WHERE '.$filter; + $sql="SELECT * FROM tblComments $filter $orderBy $limit"; + $result=$this->query($sql); + $rows=sqlite_fetch_all($result,SQLITE_ASSOC); + $comments=array(); + foreach($rows as $row) + $comments[]=$this->populateCommentRecord($row); + return $comments; + } + public function queryCommentsByPostID($id) { - $sql="SELECT * FROM tblComments WHERE post_id=$id"; + $sql="SELECT * FROM tblComments WHERE post_id=$id ORDER BY create_time DESC"; $result=$this->query($sql); $rows=sqlite_fetch_all($result,SQLITE_ASSOC); $comments=array(); -- cgit v1.2.3