We have moved our forum to GitHub Discussions. For questions about Phalcon v3/v4/v5 you can visit here and for Phalcon v6 here.

handle multiple result sets from procedure

I could not find a way to get more than one result set from calling stored procedure.

I have a stored procedure which will return 2 result sets (2 select statement) and i can get only the first result set from fetchAll().

Is there any way to get the second result set?



485

just foound a way to my question

        $result = $this->db->query("CALL procedure_name($param)");
        $result->setFetchMode(\PDO::FETCH_ASSOC);
        $resultArray=[];
        $resultArray['result1']=$result->fetchAll();
        $result->nextRowset();
        $resultArray['result2']=$result->fetchAll();
        $result->nextRowset();