pttang90
(Pennypei84)
February 25, 2013, 7:00am
1
i got a table that create from yii framework.
but i face a trouble that how do i retrieve the specific same data from database?
example
no id gender
1 1010 female
2 1111 male
3 1234 female
4 1221 female
how to do retrieve the data like this
no id gender
1 1010 female
2 1234 female
3 1221 female
mirunho
(D Mirecki)
February 25, 2013, 7:12am
2
I dont really understand what is Your problem here ? Please decribed it one more time … Do You need to make query to select only female from db or maybe something else ?
pttang90
(Pennypei84)
February 25, 2013, 7:14am
3
ya…i just want select all from who is female.
mirunho
(D Mirecki)
February 25, 2013, 7:19am
4
I think that You should go back to Yii documantation. You have really big gap of Yii knowledge, so firstly You should read http://www.yiiframework.com/doc/guide/1.1/en/database.ar but not only Active Record from there.
pttang90
(Pennypei84)
February 27, 2013, 4:09am
5
let say this is mysql form
SELECT ‘gender’
FROM worker
WHERE gender
= ‘female’
i changed it in the yii form
$gen= Yii::app()->db->createCommand()
->select('gender')
->from('gender')
->where('gender=:Gender',array(':Gender'=>'female'))
->queryAll();
$this->render('WorkerProfile',array('gender'=>$gen));
i put this in my controller,still failed to show those workers which are female.i admit i still have large gap with the yii framework.
pttang90
(Pennypei84)
February 27, 2013, 7:04am
7
i change it but still unable to solve the problem.But suppose can.
mirunho
(D Mirecki)
February 27, 2013, 7:15am
8
query looks fine, maybe i miss something, please show your view file where you want to display result of this query