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 に答える