Welcome Guest, Not a member yet? Register   Sign In
Pagination 's bug
#1

[eluser]tottyandbaty[/eluser]
Code:
$CI =& get_instance();
        
        if ($CI->config->item('enable_query_strings') === TRUE OR $this->page_query_string === TRUE)
        {
            if ($CI->input->get($this->query_string_segment) != 0)
            {
                $this->cur_page = $CI->input->get($this->query_string_segment);
                
                // Prep the current page - no funny business!
                $this->cur_page = (int) $this->cur_page;
            }
        }
        else
        {
            if ($CI->uri->segment($this->uri_segment) != 0)
            {
                $this->cur_page = $CI->uri->segment($this->uri_segment);
                
                // Prep the current page - no funny business!
                $this->cur_page = (int) $this->cur_page;
            }
        }

        $this->num_links = (int)$this->num_links;
        
        if ($this->num_links < 1)
        {
            show_error('Your number of links must be a positive number.');
        }
                
        if ( ! is_numeric($this->cur_page))
        {
            $this->cur_page = 0;
        }

is_numeric(1.)//return true

if you enter http://locahost/blog/somefunction/1.

it will return some error message
#2

[eluser]simshaun[/eluser]
And that error message is.......
#3

[eluser]tottyandbaty[/eluser]
It's about sql
#4

[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
#5

[eluser]Thorpe Obazee[/eluser]
Judging from your URL AND/OR your SQL statement, I think there's a problem with your code.
#6

[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
#7

[eluser]Thorpe Obazee[/eluser]
You should probably look into this:

http://ellislab.com/forums/viewthread/121302/#601031




Theme © iAndrew 2016 - Forum software by © MyBB