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

时间:2014-06-26 15:45:55

标签: php mysql stored-procedures pdo

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;

我的PHP代码

$strReq = "Call AfficherLocationList('$subtype'," . $result["id"] . ")";
    $req = $bd->prepare($strReq);
    $req->execute();
    $arrayOptions = $req->fetchAll(PDO::FETCH_ASSOC);

当我调试并获得结果查询时,它看起来像CALL AfficherLocationList('State',1),并且在Mysql Workbench和Php Myadmin中都可以正常工作 但在我的代码中返回一个空数组......

0 个答案:

没有答案