table_portal_topic_pic.php 857 B

12345678910111213141516171819202122232425262728293031323334
  1. <?php
  2. /**
  3. * [Discuz!] (C)2001-2099 Comsenz Inc.
  4. * This is NOT a freeware, use is subject to license terms
  5. *
  6. * $Id: table_portal_topic_pic.php 27449 2012-02-01 05:32:35Z zhangguosheng $
  7. */
  8. if(!defined('IN_DISCUZ')) {
  9. exit('Access Denied');
  10. }
  11. class table_portal_topic_pic extends discuz_table
  12. {
  13. public function __construct() {
  14. $this->_table = 'portal_topic_pic';
  15. $this->_pk = 'picid';
  16. parent::__construct();
  17. }
  18. public function count_by_topicid($topicid) {
  19. return $topicid ? DB::result_first('SELECT COUNT(*) FROM %t WHERE topicid=%d', array($this->_table, $topicid)) : 0;
  20. }
  21. public function fetch_all_by_topicid($topicid, $start = 0, $limit = 0) {
  22. return $topicid ? DB::fetch_all('SELECT * FROM %t WHERE topicid=%d ORDER BY picid DESC'.DB::limit($start, $limit), array($this->_table, $topicid)) : array();
  23. }
  24. }
  25. ?>