displaying images dynamically
Hi, I'm new to this site and php and I am trying to display images on my site dynamically. I want images on my site to change everytime the user refreshes the page. My site is a clothes site which has loads of different images stored in its database in a table called products. The products table stores all information stored on items of clothing, including the name of the image of the item, eg fen_skirt.jpg. I do not actually store the image in the database, just the name of it. The images are stored on my server in a folder called 'images'. To display out the images I append the image name to the path of my images folder. Below is an example of how I am displaying out my images:
Code:
<html><body>
<?php
include "db.php";
$sql ="select image from product where shopName = 'pure'";
$query = "SELECT * FROM product where shopName = 'pure' ";
$result = mysql_query($sql, $conn) or die(mysql_error());
if($result){
echo'
<table align="center" cellspacing="0" cellpadding="5" bgcolor="#ffffff" border=1 bordercolor="#2696b8">
<tr>
</tr>';
while($row = mysql_fetch_array($result, MYSQL_ASSOC)){
echo'<tr>
<td align="center" width="150" height="200"><img src="http://snet.wit.ie/~ciaracousins/clothes/' . $row['image'] . '">
</tr>';
}
echo'</table>';
}
else{
echo'<h1> System Error </h1> table ';
exit();
}
mysql_close();
?>
</html></body>
this code is displaying out all of the images, whereas I just want it to display out one image at a time, but to have it constantly changing. How can I do this??