Cdbdatareader Cannot Rewind When Trying To Loop Vertically

In my controller I am running a sql query like this:

I am then passing the $data variable to the view file. In the view file I want to loop through the resultset vertically like this:

However, when I try to do this I get the following error message:

Is there any way to get non forward-only reader through the query? Or should I be changing the logic in the view file somehow?

I solved it by using this instead:

queryAll();will load all data in memory , if you have a large dataSet to iterate , you 'd better use dataReader . it 's true that dataReader is forward-only .

The query that is actually performed is done on a lot of data, but the query only returns max 4 rows and 25 columns into the dataset. Can that be considered a large dataset? How can I release/clear the memory once used?

Dear Friend

Kindly check whether the following serve our purpose.

foreach ($data as $val) 


    foreach (array('hour00_01', 'hour01_02', 'hour02_03') as $field)

            echo $val[$field];


May I ask you to describe it more?

How to use it with query() and combine it in CListView or other widgets?