/*You need a database table with file names and a unique field which can identify each entry.
Then create a PHP script that looks something like this in MySQL:*/
/First open your connection to you database and select the TABLE_NAME table you have just created/
$sql = "SELECT FILE_NAME, FIELD_ID*0+rand() as rand_col FROM TABLE_NAME ORDER BY rand_col LIMIT 1"
/This query selects FILE_NAME randomly using FIELD_ID as operator and stores the values in a temporary table called rand_col. The LIMIT 1 is to make sure that only one filename is returned to the browser. There's a reason why we multiply by 0, but I won't go into that here - just trust me :-) /
$sql_result = mysql_query($sql, $connection) or die ("could not execute query");
/Then some stuff to turn your FILE_NAME into an image (suit it to your own needs):/
while($row = mysql_fetch_array($sql_result))
{
$image = $row["FILE_NAME"];
echo "<IMG SRC='$image' BORDER='1'>";
/*Kill your MySQL connection around here and you should be okay
You can see a similar version to this script at http://www.downstream.dk/
Hope it helps!
*/