CGridView problem

Hi all,

if i use the "CGridView" and try to show data in a new Column, i get some trouble…

Some Code of the used Columns in the CGridView.

>>This works:



         'value'=>'Position::Model()->findBySql("SELECT  ROUND((SUM(preis*menge)),2) AS preis

                                                 FROM    position

                                                 WHERE   bestellung_id = $data->bestellung_id")->preis',            


>>This doesn’t work



        'value'=>'Position::Model()->findBySql("SELECT bezahlt

                                                FROM   position	

                                                WHERE  bestellung_id = $data->bestellung_id 

                                                       AND position.person_id = 1")->bezahlt',


The Problem seems to be "$data->bestellung_id". If i replace it with a number, it works…

But why it doesn’t work in the second Column? The “$data->bestellung_id” is used at the same place… confusing.

The error: "Trying to get property of non-object"


Maybe it happens that there are no record returned and then (norecord)->bezahlt gives the error you are getting.