Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/mysql/65.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
在php中,mymymysql选择查询不';行不通_Php_Mysql - Fatal编程技术网

在php中,mymymysql选择查询不';行不通

在php中,mymymysql选择查询不';行不通,php,mysql,Php,Mysql,我用PHP为selectqueryformysql创建了代码 守则: $vericek4 = $baglanti2 -> prepare ("select no from urunlist where urunad like '%?%'"); $vericek4 -> bindParam(1, $aramayss); $vericek4 -> execute(); $satirsay2 = $vericek4 -> rowCount(); 我在$aramayss中有数

我用PHP为selectqueryformysql创建了代码

守则:

$vericek4 = $baglanti2 -> prepare ("select no from urunlist where urunad like '%?%'");
$vericek4 -> bindParam(1, $aramayss);
$vericek4 -> execute();

$satirsay2 = $vericek4 -> rowCount();
我在
$aramayss
中有数据。但是
$satirsay2
为空。

它“有效”。它只是没有达到你的期望。
是一个字符串,因此不能用参数值替换

您可以使用
concat()
构建
like
模式:

或者,在PHP中添加通配符,只需使用:

select no from urunlist where urunad like ?

İ按照你说的做了,但代码不起作用“代码不起作用”是什么意思?永远不要引用你的参数!它永远不会做你认为应该做的事情。
select no from urunlist where urunad like ?