pagination problems |
[eluser]immi[/eluser]
Hi all, I am new to codeigniter and new to all frameworks. I have few questions if someone can kindly reply me. 1. $config['num_links'] = '2'; shows only 2 page links? i mean if the database has 600 records and when user click it page 2 there is no page link ahead generated by pagination? 2. I am having problems with my test pagination script. when i click at page 2 it shows the records from 1 to 10 instead of 5 to 10. Controller: Code: if ($this->uri->segment(3) === FALSE) View page: Code: <table cellspacing="1" cellspacing="1">
[eluser]cideveloper[/eluser]
lets see if this helps Code: $data['query'] = $this->db->query("SELECT * from ". RINGTONES_TABLE . " WHERE cat='". $data['url_cat'] ."' ORDER BY id DESC LIMIT $limit,$offset") change to Code: $data['query'] = $this->db->query("SELECT * from ". RINGTONES_TABLE . " WHERE cat='". $data['url_cat'] ."' ORDER BY id DESC LIMIT $offset,$limit") Below from MYSQL.com Quote:With two arguments, the first argument specifies the offset of the first row to return, and the second specifies the maximum number of rows to return. The offset of the initial row is 0 (not 1):
[eluser]immi[/eluser]
Hi Thanks for your reply! I have changed to Code: $data['query'] = $this->db->query("SELECT * from ". RINGTONES_TABLE . " WHERE cat='". $data['url_cat'] ."' ORDER BY id DESC LIMIT $offset,$limit") But the pagination is still not fine. its shows me only 3 page links which i have set in Code: $config['num_links'] = '2' Any Idea Please?
[eluser]cideveloper[/eluser]
Let me get this straight Below I will give an example of what I think your urls and pagination links should look like. Tell me If this is not what it looks like First Page -------------- URL: http://localhost/ringtones/download/Hindi-Ringtones Pagination links: 1 2 3 Next Last When you click on 2 ----------------------- URL: http://localhost/ringtones/download/Hindi-Ringtones/5 Pagination links: Previous 1 2 3 4 Next Last When you click on 3 ----------------------- URL: http://localhost/ringtones/download/Hindi-Ringtones/10 Pagination links: Previous 1 2 3 4 5 Next Last When you click on 4 ----------------------- URL: http://localhost/ringtones/download/Hindi-Ringtones/15 Pagination links: First Previous 2 3 4 5 6 Next Last See if this code works Controller --------------- Code: $this->load->library('pagination'); View --------------- Code: <table cellspacing="1" cellspacing="1"> |
Welcome Guest, Not a member yet? Register Sign In |