Customised Query To To Display In Gridiew

hi all,

controller

[code]

$model=Product::model()->display_products_statistics();

	//$model->unsetAttributes();  // clear any default values


	//if(isset($_GET['Product']))


		//$model->attributes=$_GET['Product'];





	$this->render('admin',array(


		'model'=>$model,


	));

[code]

view

[code]

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

'id'=&gt;'product-grid',


'dataProvider'=&gt;&#036;model-&gt;display_products_statistics(),


'filter'=&gt;&#036;model,


'columns'=&gt;array(


	'member_count',


	'seller_count',


	'visitor_count',


	/*'Higest price',


	'lowest price',


	/*


	'desc',


	/*


	'price',


	'createdate',


	'updatedate',


	'opid',


	'pimg',


	*/


	array(


		'class'=&gt;'CButtonColumn',


		//'template'=&gt;'{update}'


	),


),

)); ?>

[code]

model

[code]

$sql="select member_count,seller_count,

	visitor_count from fc_product fp


	group by  member_count,visitor_count,seller_count


	order by member_count desc&quot;;


	&#036;connection=Yii::app()-&gt;db;


	&#036;command=&#036;connection-&gt;createCommand(&#036;sql);


	&#036;products_statistics=&#036;command-&gt;queryAll();

$dataprovider=new CArrayDataProvider($products_statistics,

array(‘pagination’=>false));

	//print_r(&#036;dataprovider);exit;


	


	return &#036;dataprovider-&gt;getData();

[code]

but then i am getting this error

Fatal error: Call to a member function getData() on a non-object in D:\wamp\www\yii\framework\zii\widgets\CBaseListView.php on line 111

I am confused and dont know whats going wrong

Plz let me know

in the model:


return $dataprovider;

instead of


return $dataprovider->getData();

and change the


$model=Product::model()->display_products_statistics();

to


$model = new Product();

in the controller - because this part is bit confused:

is equal:


'dataProvider'=> Product::model()->display_products_statistics()->display_products_statistics()

:blink: ??