<?php
$sql_rotation=mysql_query('SELECT * FROM photo_atelier');
$i=1;
while($ligne_rotation=mysql_fetch_array($sql_rotation)){
$array[$i]="../media/atelier/grand/".$ligne_rotation['photo']."";
$i++;
}
?>
<SCRIPT LANGUAGE="JavaScript">
var timeDelay = 3; // change delay time in seconds
var Pix = new Array
(
<?php
echo "'".$array[1]."',";
echo "'".$array[2]."',";
echo "'".$array[3]."',";
echo "'".$array[4]."',";
echo "'".$array[5]."'";
?>
);
var howMany = Pix.length;
timeDelay *= 1000;
var PicCurrentNum = 0;
var PicCurrent = new Image();
PicCurrent.src = Pix[PicCurrentNum];
function startPix() {
setInterval("slideshow()", timeDelay);
}
function slideshow() {
PicCurrentNum++;
if (PicCurrentNum == howMany) {
PicCurrentNum = 0;
}
PicCurrent.src = Pix[PicCurrentNum];
document["ChangingPix"].src = PicCurrent.src;
}
// End -->
</script>
<body OnLoad="startPix()">
<?php echo "<img name=ChangingPix src=".$array[1].">"; ?>