'; $nocols = 3; $n = 0; while($row = mysql_fetch_array($query)) { $n++; if($n % $nocols == 1) echo ''; echo '' . $row['f1'] . ''; if($n % $nocols == 0) echo ''; } if($n % $nocols != 0) echo ''; echo ''; mysql_close($con); ?>