public function searchclass($arrset,$pagesize,$offset){
$keyword = isset($arrset['keyword']) ? htmlentities($arrset['keyword']) : '';
$order = $arrset['order'];
$where = '';
$prefix = C('DB_PREFIX');
if ($order == 'asc') {
$order = "{$prefix}recording.rect asc";
} elseif (($order == 'desc')) {
$order = "{$prefix}recording.rect desc";
}
if ($keyword <> '') {
$keyword = (string)$keyword;
$where = "{$prefix}recording.vodname LIKE '%$keyword%'";
}
$cls = D('recording');
$arrs['count'] = $cls->field("{$prefix}recording as rec rec.recid")
->order($order)
->join("{$prefix}course ON {$prefix}course.courseid = {$prefix}recording.pid")
->where($where)
->count();
$arrs['list'] = $cls->field("{$prefix}recording.recid as sid,{$prefix}recording.rect as t,{$prefix}recording.vodname as title,{$prefix}recording.pid,{$prefix}recording.recid as aid")
->order($order)
->join("{$prefix}course ON {$prefix}course.courseid = {$prefix}recording.pid")
->where($where)
->limit($offset . ',' . $pagesize)
->select();
return $arrs;
}
thinkphp模糊查詢
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.