Hello,everyone.
I want to get all value of column user_id in users table. How to?
table users: id(PK),user_id
controller : UsersController.php
<?php
class UsersController extends Controller
{......
public function actionSearch(){
$command = Yii::app()->db->createCommand('select user_id from users');
$rows = $command ->queryAll();
foreach($rows as $key=>$val){
echo $a = $key."=>".$val;
}
print_r($a);//print the results
}
......
}
But I got the result :0=>Array 1=>Array 2=>Array 3=>Array ,all the column’s value are “Array”.And what I want is the user_id,not “Array”.
How to ? Thank you very much!