_table = 'common_district'; $this->_pk = 'id'; parent::__construct(); } public function fetch_all_by_upid($upid, $order = null, $sort = 'DESC') { $upid = is_array($upid) ? array_map('intval', (array)$upid) : dintval($upid); if($upid !== null) { $ordersql = $order !== null && !empty($order) ? ' ORDER BY '.DB::order($order, $sort) : ''; return DB::fetch_all('SELECT * FROM %t WHERE '.DB::field('upid', $upid)." $ordersql", array($this->_table), $this->_pk); } return array(); } public function fetch_all_by_name($name) { if(!empty($name)) { return DB::fetch_all('SELECT * FROM %t WHERE '.DB::field('name', $name), array($this->_table)); } return array(); } } ?>