summaryrefslogtreecommitdiff
path: root/demos/blog/protected/Common
diff options
context:
space:
mode:
authorxue <>2006-05-30 21:26:29 +0000
committerxue <>2006-05-30 21:26:29 +0000
commitb87fd00a62994d24a3708cec5f5613ed2e9a67ed (patch)
tree175dae5b58cdbeaf8d66898483c15974495ca3fc /demos/blog/protected/Common
parent75f28186a995aa930f6db9f05ec7b63bbd2cd284 (diff)
merge from 3.0 branch till 1111.
Diffstat (limited to 'demos/blog/protected/Common')
-rw-r--r--demos/blog/protected/Common/BlogDataModule.php15
-rw-r--r--demos/blog/protected/Common/schema.sql6
2 files changed, 20 insertions, 1 deletions
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();
diff --git a/demos/blog/protected/Common/schema.sql b/demos/blog/protected/Common/schema.sql
index a93512df..9c111f0c 100644
--- a/demos/blog/protected/Common/schema.sql
+++ b/demos/blog/protected/Common/schema.sql
@@ -66,5 +66,11 @@ INSERT INTO tblPosts (id,author_id,create_time,title,content,status)
INSERT INTO tblCategories (name,description,post_count)
VALUES ('Miscellaneous','This category holds posts on any topic.',1);
+INSERT INTO tblCategories (name,description,post_count)
+ VALUES ('PRADO','Topics related with the PRADO framework.',0);
+
+INSERT INTO tblCategories (name,description,post_count)
+ VALUES ('PHP','Topics related with PHP.',0);
+
INSERT INTO tblPost2Category (post_id,category_id)
VALUES (1,1);