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中都可以正常工作
但在我的代码中返回一个空数组......