Hi everyone
I'm trying to develop some code that will display a table 4x5 with a diffrent random picture in each table cell. The code below selects 20 random rows from my pictures table and creates a record set. I then use 2 loops one that repeats 4 times and one that repeats 5 times (to create the rows and coloums respetivly). This gives me 20 cells. The record set then contains 20 paths to images, i would like to put a diffrent path in each cell.
Currently the table is created and the pictures are all the same so there is a definate issue with the randomisation of the images which i belive are randomised but I then select the same one 20 times.
Can anyone help me get this working with 20 random images?
<?php
$picquery = "SELECT * FROM pic ORDER BY RAND() LIMIT 20";
$picresult = mysql_query($picquery);
$row = mysql_fetch_assoc($picresult)
?>
<table width="800" border="1" align="center" cellpadding="0" cellspacing="0">
<tr align="left" bgcolor="#FFFFFF">
<td height="253" valign="top" bgcolor="#FFFFFF"><p></p>
<table width="510" height="300" border="1" cellspacing="0" cellpadding="2" bgcolor="#FFFFFF">
<?php
for ($i = 0; $i < 4; $i++){ ?> <tr bgcolor="#FFFFFF">
<?php
for ($ii = 0; $ii < 5; $ii++)
{
$image=$row['thumb'];
?>
<td width="103" height="77">
<img src="<?php echo $image; ?>">
</td>
<?php
}
}
?>
</table>