CListView and CSqlDataProvider

I’m trying to get a paginated list view.

In my controller I have this

$listsql = 'SELECT * FROM unitlistings where '.$whereClause;

$dataProvider=new CSqlDataProvider($listsql, array(








		$this->render('search', array('dataProvider'=>$dataProvider,

In my view file search.php I have this









							)); ?>

In searchlist file I’m getting error Trying to get property of non-object

<?php echo $data->category ; ?>

where category is the name of a field in the table unitlistings

When I used <?php foreach($data as $list) echo $list[‘category’]; echo $list[‘property’]; etc… I was getting output 2 everywhere I used $list->

Pagination is working fine. Getting correct number of results and items per page.




Thanks. That solved the problem

You can always vote my post up ::)