Gridview , listview or plain simple php coding and looping?

I am getting my database values in

$rowx = Yii::app()->db->createCommand($sqlx)->queryAll();



after the form is filled up and the query is run.

Now i want to show the results of the various people one after the other?

Yes there will be rows one below the other.

Each row will contain an image some details about that item with a view more link taking the person as per his access to the row’s complete details.

No user will be able to change the rows just interact with it like clicking links

What will be the best way gridview , listview, detailview etc or plain simple php coding and looping?

Gridview or Listview.

Gridview is a readymade solution to what you are trying to do. Listview is nice in that it can be styled many different ways since each ‘item’ is rendered by a _view file.

I think the question to ask yourself is whether you want to embrace the features of the framework or not. If you want to code all your tables by hand why use a framework at all?

How will I pass data to Gridview I am having problems getting it

Start with the first example here or create an application and study the code generated for the admin action (e. g. Manage Users).


I am getting this error

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

if I do


i get

Array ( [0] => Array ( [id] => 44gfsg5 [heigh] => [end] => 1 [ion] => 1 [value1] => [moth] => 1 [upload] => 1 [highest] => [xxh] => 1 [current] => 1 [city] => [data] => dddddddddd [date] => 1986-01-01 ) ) 

So two things.

You can learn to use the ActiveDataProvider or you can use the SQLDataProvider.

I would recommend investing some time in learning Yii Active Record. For simple queries (and I think what you are posting would be) AR is very convenient.

You need to use a dataprovider with grid/list/detailview, not regular 'ole SQL. But you can use an SQLDataprovider.