Code: Select all
<table><tr>
<?php
mysql_connect("localhost", "user","password") or die ("error");
mysql_select_db("database") or die ("error");
$result = mysql_query ("select * from table order by RAND()") or die (mysql_error());
$i = 0;
while ($row = mysql_fetch_array($result)) : $i ++;
if($i==3) {
echo "</tr><tr>";
$i = 0;
}
?>
<td>
<table><tr><td>
TABLE EXAMPLE
</td></tr></table>
</td>
<?php endwhile; ?>
</tr></table>