Pagination using multiple searcing criteria in codeigniter

unfalkkat

New Member
Im trying to implement pagination using multiple searching criteria.Supposed I Have student table. I also use pagination when the list of student displayed.The pagination link is. \[code\]site_url . '/student/page/';\[/code\] so I use \[code\]$config['uri_segment'] = 1\[/code\];so the pagination link will be\[code\]<a href="http://mysite/index.php/student/page/0">1</a><a href="http://mysite/index.php/student/page/1">2</a>\[/code\]and son.After that I wanna search student data using 3 searching criteria implemented using textfield.\[code\]id name address.\[/code\]user can search by id or name or address or combination of the three criteria. the url become \[code\]http://mysite/index.php/student/page/0href=http://mysite/index.php/student/page/1\[/code\]and son.but I use get method for searching. and while trying to search using the search criteria field the url become\[code\]href="http://mysite/index.php/student/page/1?id=1&name=a&address=b\[/code\]the problem occurred when I try create pagination based on criteria. because the pagination link have contain query stringi don't know how to create become\[code\]href="http://mysite/index.php/student/page/0?id=1&name=a&address=bhref="http://mysite/index.php/student/page/1?id=1&name=a&address=b\[/code\]or do you have a best practice to solve this problem ?Hi phill ....I have try your suggestion.\[code\]$array = array('id' => '001', 'name' => 'a', 'address' => 'canada');\[/code\]the url become\[code\]id/001/name/a/address/canada\[/code\]. I use \[code\]$this->uri->uri_to_assoc()\[/code\] function to get key and value of the segment. \[code\]array ( id => 001, name=>a, address=>canada)\[/code\]but while there some searching criteria that not included while searching. let say, the user only search by name and address. the array become\[code\]$array = array('id' => '', 'name' => 'a', 'address' => 'canada');\[/code\] and the url \[code\]id/name/a/address/canada\[/code\]the assoc array become\[code\]array ( id => name, a=>address, canada=>)\[/code\]the assoc array is not disorganized again. so I can't get the right value of the assoc array.I think i will set the identifier to the searching criteria if not included. supposed i put \[code\]#\[/code\]. \[code\]if isset($_GET['id']) then$id = '#'else $id = $_GET['id']$array = array('id' => $id, 'name' => 'a', 'address' => 'canada');\[/code\]How about that ... ? or if there are another best practice ?
 
Back
Top