问题
$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