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…

"Trying to get property of non-object" means you are accessing property/method which is not defined in for object or object itself not instantiated or invalid object name.

Some code of your implementation will help to explain better.

Thanks for your reply Absar…

Here is my _view page code.


echo '<h4>'. CHtml::link(CHtml::encode($data->project_title), array('portfolioview', 'id'=>$data->id, 'title'=>$data->project_title), array('title'=>$data->project_title)).'</h4>';

			

			echo CHtml::link(CHtml::image(Yii::app()->baseUrl."/images/".$data->upload_image, "No image", array("width"=>100, "height"=>100)), array('portfolioview', 'id'=>$data->id, 'title'=>$data->project_title));

I get error in $data->project_title.

please help me

exactly, what is [color="#FF0000"]$data[/color]? Are you rendering this view from controller with $data object reference? where from $data is coming?

According to me the reference to $data is not correct.

few more links for reference.

Thanks buddy i cleared that error.

here is my code…


$data = $dataProvider->getData();

$i = 0;

$dyn_table = '<table border="1" cellpadding="10">';

foreach($data as $profile){

	if ($i % 3 == 0) { // if $i is divisible by our target number (in this case "3")

        $dyn_table .= '<tr><td>';

		$dyn_table .= '<h4>'. CHtml::link(CHtml::encode($profile['project_title']), array('portfolioview', 'id'=>$profile['id'], 'title'=>$profile['project_title']), array('title'=>$profile['project_title'])).'</h4>';

		$dyn_table .= CHtml::link(CHtml::image(Yii::app()->baseUrl."/images/".$profile->upload_image, "No image", array("width"=>100, "height"=>100)), array('portfolioview', 'id'=>$profile->id, 'title'=>$profile->project_title));

		

		

		//'<img src="'.Yii::app()->baseUrl.'/images/'.$profile['upload_image'].'" width="100" height="100"/></td>';

    } else {

        $dyn_table .= '<td>';

		$dyn_table .= '<h4>'. CHtml::link(CHtml::encode($profile['project_title']), array('portfolioview', 'id'=>$profile['id'], 'title'=>$profile['project_title']), array('title'=>$profile['project_title'])).'</h4>';

		$dyn_table .= CHtml::link(CHtml::image(Yii::app()->baseUrl."/images/".$profile->upload_image, "No image", array("width"=>100, "height"=>100)), array('portfolioview', 'id'=>$profile->id, 'title'=>$profile->project_title));

    }

    $i++;

}

$dyn_table .= '</tr></table>';

echo $dyn_table;


$this->widget('CLinkPager', array(

                                'pages'=>$dataProvider->pagination,

                   ))

 

It can help somebody…Cheers…