Hi. I'm trying to display three different random images from the same db on the same page.
Here's the code (sorry, I don't know how to put php tags on this forum)
$dbc = mysql_connect("xxx", "xxx", "xxx");
mysql_select_db("xxx", $dbc);
$sql = mysql_query("SELECT images FROM random_table") or die (mysql_error());
while($row = mysql_fetch_array($sql)){
$row_array[] = $row['images'];
}
mysql_close($dbc);
$image1 = $row_array[rand(0, count($row_array) - 1)];
I then use an include tag and echo $image1 in my html pages/tables.
And this is where I don't know what to do. I've tried several things without success. I have to add image 2 and 3 and tell the script that I want another pic if one is already displayed.
Thanks