CodeIgniter Forums
Pagination complications - Printable Version

+- CodeIgniter Forums (
+-- Forum: Archived Discussions (
+--- Forum: Archived Development & Programming (
+--- Thread: Pagination complications (/thread-20914.html)

Pagination complications - El Forum - 07-25-2009

[eluser]Tyler Diaz[/eluser]
I've been working around this pagination for hours and cannot seem to find my way into it.


        $config = array(
                        'base_url'         => site_url('inbox'),
                        'total_rows'     => 21,
                        'per_page'         => 5,
                        'uri_segment'     => 2,
                        'full_tag_open'     => '<p>',
                        'full_tag_close' => '</p>'

        $query = $this->db->query("SELECT x, x, x, x, x, x
                                   FROM `x`
                                   LIMIT ".$this->uri->segment(2).", ".$config['per_page']."

Originally the links would not work - Till I used this (".$this->uri->segment(2).") and now it return a MYSQL error due to it returns an empty string.

Then it does a foreach, then I initialize the config ($this->pagination->initialize($config)) and parse it in the view ('pagination' => $this->pagination->create_links(),) Any help?

Pagination complications - El Forum - 07-25-2009

you might try adding a default 0 to your segment function -- $this->uri->segment(2,0).

that way, you won't have it returning nothing.