table_common_district.php
1.07 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
<?php
/**
* [Discuz!] (C)2001-2099 Comsenz Inc.
* This is NOT a freeware, use is subject to license terms
*
* $Id: table_common_district.php 28647 2012-03-07 02:03:00Z chenmengshu $
*/
if(!defined('IN_DISCUZ')) {
exit('Access Denied');
}
class table_common_district extends discuz_table
{
public function __construct() {
$this->_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();
}
}
?>