2016-01-23 21 views
0

我在mysql数据库中有一个存储过程,有4个select语句(数据集),但是当我访问它时,我只得到第一行第一条选择声明;在Mysql中可以看到所有的数据集!在Yii2中访问存储过程的所有数据集(一组结果)

这是我在做Yii2:

$commande = Yii::$app->db->createCommand("call void()"); 
$result = $commande->queryAll(); 
//$result is only containing the first row of the first select statement 

我怎样才能获得的数据集数据的所有其他人呢?

回答

0

您应该使用的查询和nextResult

$commande = Yii::$app->db->createCommand("call void()"); 
$resultSet = $commande->query(); 

    echo $resultSet->getRowCount(); 

while($resultSet->nextResult() !== false) { 
    ....... your code .... 
    }; 
相关问题