Yii::app()->db->createCommand($sql1)->queryAll() is not returning whole table [closed]

流过昼夜 提交于 2019-12-23 01:54:43

问题


$rows = Yii::app()->db->createCommand()->select('*')->from('states')->queryAll();

above code returns only single first row, while according to documentation it should return all rows.


回答1:


queryAll() returns an array and u need to iterate in order to get all the records

foreach($rows as $row){
  //do something
}


来源:https://stackoverflow.com/questions/18717533/yiiapp-db-createcommandsql1-queryall-is-not-returning-whole-table

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!