A Database Error Occurred Error Number: 1064

2019-08-27 06:30发布

what do i do, with this error in codeigniter?

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 'show' at line 1

SELECT @rownum:=@rownum+1 rownum, t.* FROM (SELECT @rownum:=0) r, hotel_submits t order by id desc LIMIT 2, show

Filename: D:\xampp\htdocs\mehdi\system\database\DB_driver.php

Line Number: 330

code:

$data['results'] = $this->db->query("SELECT @rownum:=@rownum+1 rownum, t.* FROM (SELECT @rownum:=0) r, hotel_submits t order by id desc LIMIT ".$config['per_page'].", ".$this->uri->segment(3)."");

2条回答
家丑人穷心不美
2楼-- · 2019-08-27 07:13

You're not using the Codeigniter Pagination class properly.

See my answer to your other question: create jquery pagination?

Your $config['base_url'] needs your controller and method names, like so:

$config['base_url'] = 'controllerName/show';
查看更多
我命由我不由天
3楼-- · 2019-08-27 07:27

$this->uri->segment(3) is returning the string show, wich is not a valid LIMIT value.

I suppose you're calling the wrong segment.

查看更多
登录 后发表回答