0) { while ($row = mysql_fetch_assoc($result)) { $pwrlist[$row['id']] = $row['power']; } $numpwr = count($pwrlist); $thresh = 5; $maxcols = 3; $cols = min($maxcols, (ceil(count($pwrlist)/$thresh))); $percol = ceil(count($pwrlist)/$cols); $powerchk = ''; $i = 0; foreach ($pwrlist as $id => $pwr) { if (($i>0) && ($i%$percol == 0)) $powerchk .= "\n