thinkphp操作mysql的一个奇怪错误

浏览:1476 发布日期:2015/12/01 分类:求助交流 关键字: mysql 1064
thinkphp的代码为:
/* 根据模糊的where条件 */
public function gcfstm($kw){
$val='%'.$kw.'%';
$where['position']=array('link',$val);
return $where;


}
$red=$this->gcfstm($_POST['search']);
$where['_logic'] = 'OR';
$where=$red+$where;

return $this->where($where);


$count=$Recruit->count();


这是是代码片段,最终运行的mysql语句为:
SELECT COUNT(*) AS tp_count FROM `demo_recruit` WHERE ( `position` link ('%采购%') ) LIMIT 1 [ RunTime:0.000090s ]
该语句返回false
尝试执行该语句
提示#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 'link ('%采购%') ) LIMIT 1' at line 1
错误!



在phpmyadmin中
SELECT COUNT(*) AS tp_count FROM `demo_recruit` WHERE `position` LIKE '%采购%';
这个语句是可以执行行的结果为8;

最佳答案
评论( 相关
后面还有条评论,点击查看>>