[eluser]Emilhse[/eluser]
I got following problem
i try use pagination class when i use it for all records in table it works ok, but when
there is where in query it just getting craizy please help
Code:
function Posters_ads($id){
$config['base_url'] = base_url().'/newpage/index/'.$this->uri->segment(3);
$q = $this->db->query("SELECT * FROM classified WHERE AccountID = '$id'");
echo $config['total_rows'] = $q->num_rows();
$config['per_page'] = '4';
$config['full_tag_open'] = "<p class ='paginate' >";
$config['full_tag_close'] = '</p>';
$config['first_link'] = 'First Page';
$config['last_link'] = 'Last Page';
$this->pagination->initialize($config);
$data['pages'] = self::get_pads($id , 3,$this->uri->segment(4));
echo $this->uri->segment(4);
echo "<br />";
$this->load->view('home_p',$data);
}
function get_pads($id,$num,$offset)
{
$this->db->order_by('AdID','desc');
$q = $this->db->query("SELECT * FROM classified WHERE AccountID = '$id' LIMIT $num OFFSET $offset ");
return $q->result_array();
}
this is the last i tried
before it i tried this way both of them does not work
pagination shows last page and when you try to navigate it does not show current page
Code:
function Posters_ads($id){
$config['base_url'] = base_url().'/home/v_poster_other_ads/'.$this->uri->segment(3);
$q = $this->db->query("SELECT * FROM classified WHERE AccountID = '$id'");
echo $config['total_rows'] = $q->num_rows();
$config['per_page'] = '4';
$config['full_tag_open'] = "<p class ='paginate' >";
$config['full_tag_close'] = '</p>';
$config['num_links']='5';
$config['first_link'] = 'First Page';
$config['last_link'] = 'Last Page';
$this->pagination->initialize($config);
$data['pages'] = self::get_pads($id , 3,$this->uri->segment(4));
$this->load->view('home',$data);
}
function get_pads($id,$num,$offset )
{
$this->db->order_by('AdID','desc');
$this->db->where('AccountID',$id);
$query = $this->db->get('classified',$num,$offset);
return $query->result_array();
}
please help i got really stuck