📄 rank.class.php
字号:
<?php
class rank
{
var $db;
var $pages;
var $number;
var $table;
function __construct()
{
global $db;
$this->db = &$db;
$this->table = DB_PRE.'mood';
$this->table_data = DB_PRE.'mood_data';
$this->table_content = DB_PRE.'content';
}
function rank()
{
$this->__construct();
}
function show($moodid = 1)
{
$moodid = intval($moodid);
return $this->db->get_one("SELECT * FROM $this->table WHERE moodid=$moodid");
}
function get()
{
$array = array();
$result = $this->db->query("SELECT * FROM $this->table");
while($r = $this->db->fetch_array($result))
{
$array[] = $r;
}
$this->db->free_result($result);
return $array;
}
function listinfo($moodid = 1, $page = 1, $pagesize = 50, $where = '')
{
$array = array();
$page = max(intval($page), 1);
$offset = $pagesize*($page-1);
$limit = " LIMIT $offset, $pagesize";
$r = $this->db->get_one("SELECT count(*) as number FROM $this->table_content c,$this->table_data d WHERE c.contentid=d.contentid AND d.moodid='$moodid' $where");
$number = $r['number'];
$this->pages = pages($number, $page, $pagesize);
$array = array();
$result = $this->db->query("SELECT * FROM $this->table_content c,$this->table_data d WHERE c.contentid=d.contentid AND d.moodid='$moodid' $where ORDER BY d.total DESC");
while($r = $this->db->fetch_array($result))
{
$array[] = $r;
}
$this->number = $this->db->num_rows($result);
$this->db->free_result($result);
return $array;
}
}
?>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -