mizan3008
(Mizanur Rahman)
April 24, 2014, 6:25pm
1
hi,
I use this query to get my meals records. I have 2 rows in my meals table but it return me only one row
[sql]$meals = Yii::app()->db->createCommand()
->select('m.meal_id, mb.first_name, mb.last_name, m.breakfast, m.lunch, m.dinner, m.added_datetime')
->from('member mb')
->join('meal m', 'mb.member_id= m.member_id')
->where('mb.is_active=:status and mb.mess_id=:mess_id',
array(
':status'=>1,
':mess_id'=>Yii::app()->user->mess_id,
)
)
->queryRow();[/sql]
need help please…
phtamas
(Phtamas)
April 24, 2014, 6:47pm
2
CDbCommand::queryRow() returns one row by design. Try queryAll().
mizan3008
(Mizanur Rahman)
April 24, 2014, 6:57pm
3
Thanks a lot for you help I did not know about queryAll().
But my where condition is not working if i use this queryAll(). so what i should to do right now…?
Thanks again…
jkofsky
(Jkofsky)
April 24, 2014, 7:39pm
4
What does ‘not working’ mean? Still getting only one record? Now getting no records? It’s no longer an Object?
mizan3008
(Mizanur Rahman)
April 24, 2014, 8:19pm
5
thank you for your kindness jkofsky.
i have a is_active field in my member table so i want to get those member’s record whose is_active=1. but this queryAll() returned me all members whose is_active = 1 and 0 too. this is the problem.
thanks…