Problem with offset in the url |
In the pagination when I change the number of the page with 0 or any other text give me an error of query, of course.
I could take it off with disable the debug mode in the database.php But In tI would equally be a mistake not pleasant. For this reason, in that way I can set an 404 error page when $offset it is different from a number and it is 0? I can try with a simply if, but it does not work. Thanks for the reply ![]()
The offset should be passed to the controller method for the paged content, so you should check the $offset value there before using it. Generally, I would cast the value to an int
Code: $offset = (int) $offset; Code: $num_pages = (int) ceil($total_rows / $per_page); If the value doesn't fall in that range, I usually default it to the closest valid value (1 or $num_pages), then redirect with the new $offset and display an error message that the requested page is not valid. If you want to display a 404 error, you can do that instead of redirecting. |
Welcome Guest, Not a member yet? Register Sign In |