Hi

Modulus is your friend in this circumstance

I use a Foreach to loop through queries, I think a while loop may be faster though but same applies

so:

$cols = 2;

foreach($result as $k => $v) {

    if ($k%$cols == 0){
       echo '</tr><tr>';
    }
}

Hope you get the drift, not tested code

Dan Rossi wrote:
Hi i was wondering if there was any functionality yet for paging with Zend_Db. I was also wondering if there was a way to have these paged results able to be split into columns of 2 to 3 columns per row when fetchAll is called ? Currently I have to do this which seem a bit clunky to me

$cols = 2;
       $loop = ceil(count($results) / $cols);
       $arr = array();          for ($j=0;$j <= $loop;$j++) {
           $arr[$j] = array_slice($results,$i,$cols);
           $i = $i + $cols;
}

Reply via email to