Welcome Guest, Not a member yet? Register   Sign In
pagi problem
#1

[eluser]finord[/eluser]
Hello, not because the page does not work. I used the same scheme to other sites, the only change has been, is that they have used the WHERE clause.

Loading shows me some records, but these appear on the second page and I can not switch to the first page. And there is no value in the url, after the $ eid


Controller:
Code:
function exsDetView($eid){
           // load pagination class
    $config['base_url'] = base_url().'index.php/adpos/exs/exsDetView/'.$eid.'/';
    $this->db->like('eid', $eid);
    $this->db->from('pos_exs_con');
    $config['total_rows'] =$this->db->count_all_results();
    $config['per_page'] = '3';
    $config['first_link'] = 'Primero';
    $config['last_link'] = 'Ultimo';
    $config['full_tag_open'] = '<div class="pg">';
    $config['full_tag_close'] = '</div>';
    $this->pagination->initialize($config);
    //load the model and get results
    $uri=$this->uri->segment(5);
    $data['op']="3";
    $data['results'] = $this->cate->exspvd($config['per_page'], $uri, $eid);
    $this->load->view('/pos/admin/ex', $data);

}

Model:
Code:
function exspvd($perpage, $offset, $eid){
      $this->db->where('eid', $eid);
      $this->db->limit($perpage, $offset);
      $this->db->order_by('exsid', 'ASC');
      $querys = $this->db->get('pos_exs_con');
       return $querys;
}

View:
Code:
foreach($results->result() as $row){
$exid=$row->exsid;
$fecha=$row->fecha;
$hora=$row->hora;
$local=$row->local;
$exscta=$row->exscta;
$pid=$row->pid;
if($exid % 2) {echo "<tr class=\"odd\">";}else {echo "<tr class=\"even\">";}$ib="0"; ?&gt;
<td>&lt;? echo $exid;?&gt;</a></td>
            <td>&lt;? echo $pid; ?&gt;</td>
            <td>&lt;? echo $exscta; ?&gt;</td>
                <td>&lt;? echo $local; ?&gt;</td>
        <td>&lt;? echo $fecha; ?&gt;</td>
        <td>&lt;? echo $hora; ?&gt;</td>

&lt;? }?&gt;</div></table>&lt;?echo  $this->pagination->create_links();
To count the total records, I used what was in this post http://ellislab.com/forums/viewreply/331474/

If someone can tell me where the error, I would appreciate that.
#2

[eluser]spmckee[/eluser]
You need to include the appropriate table name:

Code:
$config['total_rows'] =$this->db->count_all_results('my_table');
#3

[eluser]finord[/eluser]
Thanks for the reply ^ ^
I have not used it because I had to select some specific queries. But I found the solution, the problem is that almost all the other functions, the uri was "4", and so to avoid having to be stating the function uri_segment, the change in Pagination.php library, and of course me caused problems, but as I have changed to always pass the uri_segment from local function.

Bye




Theme © iAndrew 2016 - Forum software by © MyBB