PHP ci框架的query方法支持 ? 占位符
$sql="select id,name,phone from class where id>? and id<?";
return $this->db->query($sql,array($idStart,$idEnd))->result_array();
难道不支持名字占位符吗?
$sql="select id,name,phone from class where id>:idStart and id<:idEnd";
return $this->db->query($sql,array('idStart'=>$idStart,'idEnd'=>$idEnd))->result_array();
结果提示语法错误,请问诸位是不支持还是我的用法错误
谢谢各位了
‘idStart’和‘idEnd’前面都加上一个‘:’试一下。