Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/batch-file/5.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 为什么不是';我的mysqli状态是否在flex 4.5中工作?_Php_Mysqli_Flash Builder_Prepared Statement - Fatal编程技术网

Php 为什么不是';我的mysqli状态是否在flex 4.5中工作?

Php 为什么不是';我的mysqli状态是否在flex 4.5中工作?,php,mysqli,flash-builder,prepared-statement,Php,Mysqli,Flash Builder,Prepared Statement,大家好,我正在使用flex 4.5和php,我有一个服务php文件,其中有一个查询,它实际上在工作链接此查询检索特定的产品信息。但是当我想得到类似的语句时?%不起作用,这里是工作代码 public function getProductsByName2($searchStr) { $stmt = mysqli_prepare($this->connection, "SELECT products.id,

大家好,我正在使用flex 4.5和php,我有一个服务php文件,其中有一个查询,它实际上在工作链接此查询检索特定的产品信息。但是当我想得到类似的语句时?%不起作用,这里是工作代码

public function getProductsByName2($searchStr) {
     $stmt = mysqli_prepare($this->connection,
          "SELECT
              products.id,
              products.codb,
              products.nombre,
              products.precio,
              products.cantidad
           FROM products where products.nombre LIKE ?");
      $this->throwExceptionOnError();


      mysqli_stmt_bind_param($stmt, 's', $searchStr);
这段代码实际上可以获得特定的产品信息,但必须与名称完全匹配,例如,如果我想检索所有以“c”开头的名称,我应该有这样的代码

public function getProductsByName2($searchStr) {
     $stmt = mysqli_prepare($this->connection,
          "SELECT
              products.id,
              products.codb,
              products.nombre,
              products.precio,
              products.cantidad
           FROM products where products.nombre LIKE CONCAT('%',?,'%')");
      $this->throwExceptionOnError();


      mysqli_stmt_bind_param($stmt, 's', $searchStr);
但是不知何故,它不起作用了,请提供任何帮助,非常感谢

我从未见过用MYSQL的CONCAT方法添加“%”。相反,我想在PHP范围内添加
%
,因此:

// ...
FROM products where products.nombre LIKE ?");
// ...
mysqli_stmt_bind_param($stmt, 's', '%' . $searchStr . '%');

希望这能有所帮助。

除非我弄错了,否则这个问题与Flex和Flash Builder无关?这更像是一个“如何用PHP查询数据库”的问题,对吗?我删除了Flex标签并添加了PHP.nope:(我太绝望了,我还尝试了$searchStr=$searchStr.'%';mysql_stmt_bind_param($stmt,'s',$se…);还有@Lukxby。很抱歉,我编辑了你的帖子,但我不知道如何确保你从这个帖子中得到更新