$rows = mysql_num_rows($result) ; for ($j=0 ; $j < 3 ; $j++) { for ($i=0 ; $i < 3 ; $i++) { $row = mysql_fetch_array($result) ; echo \'
You need:
echo '';
instead of:
echo "\r\n";