Home  >  Article  >  Backend Development  >  zand framwork pdo 预处理 参数绑定长度不同 获取不到值,但库里是有值的,为什么?

zand framwork pdo 预处理 参数绑定长度不同 获取不到值,但库里是有值的,为什么?

WBOY
WBOYOriginal
2016-06-06 20:28:341317browse

​sql:select .... where .... district=:district
代码如下:

<code>​$stmt = $this->db->query(
   ​    ​$res['searchstr'],  //sql 语句
   ​    ​$whereis  //绑定参数的数组
​);
</code>

$data = $stmt->fetchAll();

如果 district 为北京有值,为 内蒙古自治区 则没有值,但库中是有值的。

回复内容:

​sql:select .... where .... district=:district
代码如下:

<code>​$stmt = $this->db->query(
   ​    ​$res['searchstr'],  //sql 语句
   ​    ​$whereis  //绑定参数的数组
​);
</code>

$data = $stmt->fetchAll();

如果 district 为北京有值,为 内蒙古自治区 则没有值,但库中是有值的。

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn