The Code Suddenly Doesn't Work

It’s pretty strange, it worked before, but then suddenly when I come back, it show the error message:

<?php $this->widget('zii.widgets.grid.CGridView', array(










// other column


I read the error message and it revealed that it unable to send $data->user_id to getName($id) function of User model:

Trying to get property of non-object 


..\framework\base\CComponent.php(606) : eval()'d code(1): User::getName(null) 

There is no way to fix it to me, anyone got this problem before?

Which model are you calling? User model?

If so, right before the code you posted (inside PHP of course) try this and show us what appears:

CVarDumper::dump( User::model()->findAll() , 10, true ); die;

The problem is User_id=null , so check why is null ?

can you try to edit code to be :


if not work try to add user_id as number


let us know what happend ?

Thank all, I fixed it, wrong syntax after all :)