Blulagoon wrote:Adding a limit to your code will select a single image at random:
$sql = "SELECT * FROM `ads` ORDER BY RAND() LIMIT 1";
// then
$result=mysql_query($sql);
$row=mysql_fetch_array($result);
// details you want contained in $row['HREF'] etc.
HTH - Blu
So This is bascily what I need to insert right?
$sql = "SELECT * FROM `ads` ORDER BY RAND() LIMIT 1";
$result=mysql_query($sql);
$row=mysql_fetch_array($result);
{
$ad =& $ads[];
$ad['HREF'] = $row->HREF;
$ad['SRC'] = $row->SRC;
$ad['ALT'] = $row->ALT;
}
And then below that code I would just enter an HTML code?
<tr><td>
<a href='{$ads[0]['HREF']}'><img src='{$ads[0]['SRC']}' alt='{$ads[0]['ALT']}' border=0></a></td></tr>
Sorry but I am very new to .php