ArticleDao.php 1.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. <?php
  2. Doo::loadCore ( 'db/DooModel' );
  3. class ArticleDao extends DooModel{
  4. public $aid;
  5. public $cid;
  6. public $title;
  7. public $content;
  8. public $time;
  9. public $displayorder;
  10. public $_table = 'zhhelp_article';
  11. public $_primarykey = "aid";
  12. public $_fields = array ('aid', 'title', 'content', 'time', 'cid','displayorder' );
  13. /**
  14. * 获取
  15. * Enter description here ...
  16. */
  17. function get_article() {
  18. $sql = "select * from " . $this->_table;
  19. $query = Doo::db ()->query ( $sql );
  20. $result = $query->fetchAll ();
  21. return $result;
  22. }
  23. /**
  24. * 根据id获取文章
  25. * @param unknown_type $aid
  26. */
  27. function get_article_by_aid ( $aid ){
  28. $sql = "select displayorder,aid, title, content, time, cid from " . $this->_table . " where aid=" . $aid;
  29. $query = Doo::db ()->query ( $sql );
  30. $result = $query->fetch ();
  31. return $result;
  32. }
  33. /**
  34. * 根据分类获取文章
  35. * @param unknown_type $cid
  36. */
  37. function get_article_by_cid($cid = 0) {
  38. $sql = "select displayorder,aid, title, content, cid from " . $this->_table . " where cid=" . $cid;
  39. $query = Doo::db ()->query ( $sql );
  40. $result = $query->fetchAll ();
  41. return $result;
  42. }
  43. }
  44. ?>