$i = 1; while($info = mysql_fetch_array($query)) { echo $info['row']; if($i%3 == 0) { echo "<br />"; } $i++; }