Trying To Get Property Of Non-Object

hi guys…

may i know what does "Trying to get property of non-object" mean?

how and where can i look for the error?

thank you…:)

This means that you’re trying to access property of something, that is not an object.

For example, if you do something like this


$model = MyModel::model()->findByPk('non_existent_primary_key');

the $model will be null, so if you do


echo $model->id;

you’ll get this error.

hi ORey…

thanks for your explaination…:)

but can i show you mine?? i mean,my error…

i don’t know how i suppose to find my “none property object”…

sure, paste it right here.

thank you oRey…:D

5192

error.png

5193

error1.png

5194

error2.png

5195

error3.png

Seems like the problem is somewhere here


C:\BitNami\wappstack-5.4.22-0\apache2\htdocs\yii\framework\zii\widgets\grid\CDataColumn.php(137): CComponent->evaluateExpression("$data->neg->neg_lawat", array("data" => Permohonan, "row" => 4))

I guess that your ‘neg’ relation is null sometimes (left join), so calling $data->neg->neg_lawat will cause this error.

Also i think that Permohonan must be either quoted or dollar-signed ($Permohonan), so check your XController.

yes ! i got it !

i got to fix that error…

thank you so much, oRey…really appreciate it…:D

i hope you can help me next time…^^