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);
如何实施?如何设置分页?
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);
如何实施?如何设置分页?
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
而已