0
Url - localhost/ci/test/test_que/1

$sql="
select qo.id,
       qo.text 
FROM quiz_question qq,
quiz_question_option qo 
WHERE qq.id='".$qid."' 
AND qq.id=qo.quiz_question_id";

$q=$this->db->query($sql,$num,$qid);

如何实施?如何设置分页?

4

1 回答 1

0
private function total_rows($sql){
$Query = $this->db->query($sql);
return $Query->num_rows();

}

$this->load->library('pagination');

$config['base_url'] = 'localhost/ci/test/test_que/1'; //your base url
$config['uri_segment'] = 3; //set URI Segment
$config['total_rows'] = $this->total_rows($sql); //your sql query for counting rows
$config['per_page'] = 10; //files or questions per page


$this->pagination->initialize($config); //put this in view 

而已

于 2012-09-10T12:09:19.850 回答