【发布时间】:2013-03-18 09:59:11
【问题描述】:
我对使用此代码收到的此错误感到非常困惑
$this->db->order_by('uid','DESC')->where('type!=',"Admin")->get('user_profile',$config['per_page'], $this->uri->segment(3));
这是我得到的错误
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 ''Admin' ORDER BY `uid` DESC LIMIT 10' at line 3
SELECT * FROM (`user_profile`) WHERE `type!=` 'Admin' ORDER BY `uid` DESC LIMIT 10
Filename: C:\wamp\www\proposal\system\database\DB_driver.php
Line Number: 330
【问题讨论】:
-
尝试在
type和!=之间放置一个空格 -
对不起,在google和stackoverflow研究之后,我找到了解决方案。只有一个必须在操作员和字段之间放置空间。在我的例子中 $this->db->where('type !=',"Admin")