function getList($courseId, $paperId, $type, $pagesize) { $tblSection = new DB_Haodu_CourseSection(); $where = "where course_id={$courseId}"; $orderby = "order by id desc"; if ($paperId > 0) { if ($type == 1) { $where .= " and id < {$paperId}"; $orderby = "order by id desc"; } else { $where .= " and id > {$paperId}"; $orderby = "order by id asc"; } } return $tblSection->fetchLimit("*", $where, $orderby, 1, $pagesize); }