一个关于where()的问题
public function test(){
$res = $this->db->select('id')->where('id!=', 1)->get('char')->row_array();
var_dump($this->db->last_query());exit;
}
显示错误:
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 '1' at line 3
SELECT `id`FROM (`char`)WHERE `id!=` 1
Filename: D:\Web\wamp\www\maimoe\system\database\DB_driver.php
Line Number: 330
之前用where('id!=', 1)这种写法未出现过错误,手册中也说明可以这样编写,可是今天突然出现这个问题。
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 '1' at line 3
看下自己数据库版本。 id和!=间留个空格吧。ci给你换成一个字段了。 seedo 发表于 2012-12-15 14:29 static/image/common/back.gif
id和!=间留个空格吧。ci给你换成一个字段了。
次奥 范2了 stellahime 发表于 2012-12-15 14:35 static/image/common/back.gif
次奥 范2了
这个不范2哦, 这个也算CI的一个特色吧
页:
[1]