need help

Discussion in 'Scripts, 3rd Party Apps, and Programming' started by bradleyx, Apr 10, 2014.

  1. bradleyx

    bradleyx Member

    Messages:
    108
    Likes Received:
    1
    Trophy Points:
    18
    i need some help no matter what i am trying it doesnt work.

    using codeigniter 2.0.2

    i want to set up pagination for my website.

    this is what i have in my crontroller:
    Code:
      $config = array();
      $config["base_url"] = base_url() . "/credits";
      $config['total_rows'] = 200;
      $config['per_page'] = 2;
      $config["uri_segment"] = 3;
      $this->pagination->initialize($config);
      $page = ($this->uri->segment(3)) ? $this->uri->segment(3) : 0;
      $data["results"] = $this->credits_model->
      fetch_countries($config["per_page"], $page);
      $data["links"] = $this->pagination->create_links();
    

    model:
    Code:
      public function record_count() {
      return $this->db->count_all("sadmin_credits");
      }
      public function fetch_countries($limit, $start) {
      $this->db->limit($limit, $start);
      $query = $this->db->get("sadmin_credits");
      if ($query->num_rows() > 0) {
      foreach ($query->result() as $row) {
      $data[] = $row;
      }
      return $data;
      }
      return false;
      }
    
    i need some help in getting to work. it shows the numbers but i click on the numbers it just shows the same results nothing changes.
    it shows same results on first page instead of different records. need help fixing that.


    btw i read the guide, tried google. followed everything nothing works just shows same page that it shows on the link.

    this is the guide i used: http://www.sitepoint.com/pagination-with-codeigniter/
     
    • Disagree Disagree x 1
  2. studio5

    studio5 Member

    Messages:
    33
    Likes Received:
    2
    Trophy Points:
    8
    This may sound elementary, but did you connect to your mysql server?
    The CodeIgniter script was grabbing countries from a db, are you using a db to contain your credits in?
    Seems like alot of extra lifting?
    Have you tried to echo your results similar to the script above?
     
    Last edited: Apr 26, 2014
  3. studio5

    studio5 Member

    Messages:
    33
    Likes Received:
    2
    Trophy Points:
    8
    If you want complete scripts ready to use try "http://hotscripts.com" they have a great collection, even though they are getting a bit stale.
     

Share This Page