Pagination 's bug - 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: Pagination 's bug (/showthread.php?tid=20112) |
Pagination 's bug - El Forum - 06-29-2009 [eluser]tottyandbaty[/eluser] Code: $CI =& get_instance(); is_numeric(1.)//return true if you enter http://locahost/blog/somefunction/1. it will return some error message Pagination 's bug - El Forum - 06-29-2009 [eluser]simshaun[/eluser] And that error message is....... Pagination 's bug - El Forum - 06-29-2009 [eluser]tottyandbaty[/eluser] It's about sql Pagination 's bug - El Forum - 06-29-2009 [eluser]tottyandbaty[/eluser] see :http://www.windy020.com/index.php/life/index/0/11. it will return : A Database Error Occurred Error Number: 1064 You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '11., 11' at line 4 SELECT * FROM (`life`) ORDER BY `time` desc LIMIT 11., 11 Pagination 's bug - El Forum - 06-29-2009 [eluser]Thorpe Obazee[/eluser] Judging from your URL AND/OR your SQL statement, I think there's a problem with your code. Pagination 's bug - El Forum - 06-29-2009 [eluser]tottyandbaty[/eluser] 首先 ,我的代码不存在任何问题。 通常情况下,正常显示的URL为: http://www.windy020.com/index.php/life/index/0/11 那么这个时候$SQL="SELECT * FROM (`life`) ORDER BY `time` desc LIMIT 11,11 "; 显示很正常 。 但是 如果我在在地址栏这么写 : http://www.windy020.com/index.php/life/index/0/11. 最后面包含一个 “.” 很明显这个时候SQL出现语法错误! 在分页类中 使用is_numeric来判断 是否为整数 ,但是is_numeric(1.)会返回 true Pagination 's bug - El Forum - 06-30-2009 [eluser]Thorpe Obazee[/eluser] You should probably look into this: http://ellislab.com/forums/viewthread/121302/#601031 |