Welcome Guest, Not a member yet? Register   Sign In
How can Do this in Pagination
#5

[eluser]phantom-a[/eluser]
[quote author="Sumon" date="1220788050"]You can use
Code:
$this->db->orderby("date" , "asc");
in order to get order by clause.[/quote]

I've tried that one too, I does not alter the table for reason. I don't think any data is actually getting passed to it.


Well this my complete code. It works 99% except it loads the rows in the wrong order. its showing the oldest one's first, thats I why I want too use ORDER BY and reverse the order, but it does not work. Smile

*controller
Code:
function cgi_proxies() //Loads the cgi_proxies/index.php/go/cgi_proxies
    {  

        //cgi proxy list settings - EDIT THIS
        $data['mybaseurl'] = "http://127.0.0.1"; //set your baseurl like http://www.example.com/  without trailing slash
          $data['title'] = "Proxy Toplinks 0.1Beta - CGIPROXIES List"; //cgi_proxies  page title
        $data['heading'] = "CGI proxies"; // Heading
        //stop editing
        // load pagination class
        $this->load->library('pagination');
        $this->load->model('cgiproxies_model');
        $config['base_url'] = base_url().'index.php/go/cgi_proxies/';
        $config['per_page'] = '5';
        $all_result_set = $this->cgiproxies_model->get_cgiproxies('',$config['per_page'],$this->uri->segment(3));
        $this->db->orderby("datestamp" , "desc");
        $config['total_rows']=$all_result_set['num_rows'];
        $data['results']=$all_result_set['result'];

     // the rest of pagination settings
        $config['full_tag_open'] = '<p>';
        $config['full_tag_close'] = '</p>';
        $this->pagination->initialize($config);


        
        // load the HTML Table Class
        $this->load->library('table');
        $this->table->set_heading('ID', 'Title', 'Author', 'Description');
        
        // load the view
        $this->load->view('cgi_proxies', $data);

*the model class "cgiproxies_model"
Code:
class cgiproxies_model extends Model {
  function __construct(){
    parent::Model();
  }

function get_cgiproxies($param,$limit=15,$offset){
     $this->db->select('*');
     $data['num_rows'] = $this->db->count_all_results('links');
     $data['result'] = $this->db->get_where('links', array('category' => 1),$limit,$offset);
     $this->db->orderby("datestamp" , "asc");
     return $data;
}
}


Messages In This Thread
How can Do this in Pagination - by El Forum - 09-06-2008, 09:04 PM
How can Do this in Pagination - by El Forum - 09-07-2008, 12:11 AM
How can Do this in Pagination - by El Forum - 09-07-2008, 12:23 AM
How can Do this in Pagination - by El Forum - 09-07-2008, 12:47 AM
How can Do this in Pagination - by El Forum - 09-07-2008, 12:51 AM
How can Do this in Pagination - by El Forum - 09-07-2008, 12:52 AM
How can Do this in Pagination - by El Forum - 09-07-2008, 01:01 AM
How can Do this in Pagination - by El Forum - 09-07-2008, 01:14 AM
How can Do this in Pagination - by El Forum - 09-07-2008, 01:20 AM
How can Do this in Pagination - by El Forum - 09-07-2008, 01:27 AM



Theme © iAndrew 2016 - Forum software by © MyBB