In yii how to access other tables fields

Posted by user1636115 on Stack Overflow See other posts from Stack Overflow or by user1636115
Published on 2012-12-15T05:01:16Z Indexed on 2012/12/15 5:03 UTC
Read the original article Hit count: 103

Filed under:

I am creating project in yii framework. I am having table as- Qbquestion QbquestionOption
-questionId -optionId -question -questionId -userId -option -isPublished -isAnswer

In QbquestionOption controller i want to access Qbquestion tables fields. I had written quesry as-

 $Question=Qbquestion::model()->findAllByAttributes(array("questionId"=>$number));

where $number is some random number. When i am using its fields as= $Question->isPublished then its giving error as "trying to get access to property of non-object" Statement var_dump($Question) is showing all record and all values of Qbquestion table. So how can i access records? Please help me

© Stack Overflow or respective owner

Related posts about yii