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

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

WBOY
Release: 2016-06-06 20:28:34
Original
1385 people have browsed it

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

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

$data = $stmt->fetchAll();

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

回复内容:

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

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

$data = $stmt->fetchAll();

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

Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template