#display results $i = -1; while ($row = mysql_fetch_array($result)) { $i++; if ( $i >= 4 ) { $i = 0; echo ""; } echo " "; }