I have a problem with pagenition pls help - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20) +--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23) +--- Thread: I have a problem with pagenition pls help (/showthread.php?tid=54632) |
I have a problem with pagenition pls help - El Forum - 09-17-2012 [eluser]Fahad Alrahbi[/eluser] Hello ,all i am using codeigniter with Smarty template engine and when i try to use pagenition it's working but if Url is http://localhost/cic/showq/viewv/8 and i add (') or (-) i got error after add http://localhost/cic/showq/viewv/-8 error msg is Quote:A Database Error Occurred My Code controllers : Code: <?php Template showq.tpl Code: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> I have a problem with pagenition pls help - El Forum - 09-18-2012 [eluser]skunkbad[/eluser] The pagination class needs to use a number, not a number with extra chars you feel like adding. Why do you need those extra chars? Maybe re-read the user guide section on pagination; it's really easy to do when you follow the guide. I have a problem with pagenition pls help - El Forum - 09-18-2012 [eluser]Fahad Alrahbi[/eluser] Hello , Thanks for reply i want if visitor change the page url he will go to first page not showing db error is my code correct ? im new in codeigniter I have a problem with pagenition pls help - El Forum - 06-19-2013 [eluser]johanriyan[/eluser] hello, i have same error. how to fix. I have a problem with pagenition pls help - El Forum - 06-22-2013 [eluser]Ckirk[/eluser] You could make use of the form validation library to determine whether $this->uri->segment(3) is actually a number. I've changed your code so try the code below. It's untested but should work. I haven't accounted for anyone entering a valid page number, which exceeds the number of records in the database. In this scenario your query would return zero results but I'm sure you know how to handle that - at least there's no DB/SQL errors now Code: <?php I have a problem with pagenition pls help - El Forum - 06-23-2013 [eluser]johanriyan[/eluser] thks guys, Code: $page = !$this->form_validation->is_natural($this->uri->segment(3)) ? 0 : $this->uri->segment(3); how to show show_404(); if page not valid. I have a problem with pagenition pls help - El Forum - 06-24-2013 [eluser]Pert[/eluser] You can force 404 error, there are some examples on this page http://stackoverflow.com/questions/1236768/codeigniter-php-forcing-a-404 You could also help visitor out a little and normalise the values Code: if ($page < 1) This way they will still see meaningful information rather than are forced to 404 page. Lets say there is only one item on the last page that they are trying to access and you delete said item, they will end up on 404 page when in fact it would be more helpful if it just lands on last page available. I have a problem with pagenition pls help - El Forum - 06-24-2013 [eluser]johanriyan[/eluser] when i am add (-) in URL, i want show such as image. how to create. I have a problem with pagenition pls help - El Forum - 06-24-2013 [eluser]Ckirk[/eluser] [quote author="johanriyan" date="1372131698"]when i am add (-) in URL, i want show such as image. how to create.[/quote] Code: if(!$this->form_validation->is_natural($this->uri->segment(3))) show_error('You are not authorised to perform this action'); |