Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/276.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 我的存储过程在测试时工作正常,但没有返回任何PDO_Php_Mysql_Stored Procedures_Pdo - Fatal编程技术网

Php 我的存储过程在测试时工作正常,但没有返回任何PDO

Php 我的存储过程在测试时工作正常,但没有返回任何PDO,php,mysql,stored-procedures,pdo,Php,Mysql,Stored Procedures,Pdo,还有我的php代码 Set @req =CONCAT('Select name, id',Ptype,' from ',Ptype); IF Ptype = "Country" THEN SET @req = CONCAT(@req,' where idContinent=',Psurtypeid); ELSEIF Ptype="State" THEN SET @req = CONCAT(@req,' where idCountry=',Psurtypeid); ELSEIF P

还有我的php代码

Set @req =CONCAT('Select name, id',Ptype,' from ',Ptype);
IF Ptype = "Country" THEN
    SET @req = CONCAT(@req,' where idContinent=',Psurtypeid);
ELSEIF Ptype="State" THEN
    SET @req = CONCAT(@req,' where idCountry=',Psurtypeid);
ELSEIF Ptype="Area" THEN
    SET @req = CONCAT(@req,' where idState=',Psurtypeid);
END IF;
PREPARE stmt FROM @req;
EXECUTE stmt;
DEALLOCATE PREPARE stmt;
当我调试并获得结果查询时,它看起来像这样
调用AfficherLocationList('State',1)
,并且在Mysql Workbench和Php Myadmin中都可以正常工作
但是在我的代码中返回一个空数组…

Add
$bd->setAttribute(PDO::ATTR_ERRMODE,PDO::ERRMODE_异常)在连接打开之后,如果您还没有这样做,请查看它是否会产生任何结果。加上,
$bd
变量;我以前见过这样的情况,它是混合的,应该是
$db
。确保这实际上是正确的变量,而不是错误显示提示的typo.Thx。它帮了我:)而且$bd变量只是法语中的$dbyour,不用客气。是的,我对
bd
有一种感觉,我认为它代表“base de données”;-)
$strReq = "Call AfficherLocationList('$subtype'," . $result["id"] . ")";
    $req = $bd->prepare($strReq);
    $req->execute();
    $arrayOptions = $req->fetchAll(PDO::FETCH_ASSOC);