PDO 'LIKE' 查询
问题描述
由于我刚开始使用 PDO 并且在偏离简单的 select from 查询时遇到问题,我想我最好在这里询问.
Since I'm new to using PDO and running into a problem when deviating from a simple select from query, I figured I'd best ask around here.
代码:
变量 $sSearch
是我想在查询中绑定到 :search
的.对于这个例子,我已经在其中设置了一个值,但显然我想用一个 POST 变量替换它,这就是我首先要使用 PDO 的原因.
The variable $sSearch
is what I want to bind to :search
in the query. For this example, I've set a value in it, but obviously I want to replace that with a POST variable which is why I want to use PDO in the first place.
但是,该查询已经用 $sSearch
替换为一些搜索值进行了测试并且可以正常工作,但是现在我已经使用 PDO 执行相同的查询,并且得到一个空白结果.嗯,真的是一个空数组.
However, the query has been tested with $sSearch
replaced by some searchvalue and works, but now I've used PDO to perform the same query, and I get a blank result. Well, an empty array really.
那么我在这里错过了什么?
So what am I missing here?
推荐答案
根据 Amelia 的评论,答案如下:
Per Amelia’s comment, here is the answer:
和
成功了.
这篇关于PDO 'LIKE' 查询的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!