Slideshow problem
| From: | Fates | Date: | Wed, 07 Mar 2001 11:46:49 +0000 |
| Subject: | Slideshow problem | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-42892@lists.php.net to get a copy of this message | ||
My problem is the images are displayed all at once instead of one at a
time. So I get 10 images all on one page. How do I make it display one
image at a time like a slideshow instead of all images on one web page?
. The problem seems to be within my loop. I am using latest php4
version.
// sloppy programming ahead
// Begin Random Function
// Anyone know of a better way to randomize?
function random($max = 1) {
static $startseed = 0;
if (!$startseed) {
$startseed = hexdec(uniqid(''))%getrandmax();
srand($startseed);
}
return ((rand()/getrandmax())*$max);
} //end function
if ($result) {
/* Print these results to the screen in a nice format */
$i = 0;
$number = 3;
IF ($number == 0) :
PRINT "<CENTER><P>There were no records matching your
query</CENTER>";
PRINT "$abc";
ELSEIF ($number > 0) :
//PRINT "<CENTER><P>Search Results Returned:
$number</CENTER><BR><BR>";
WHILE ($i < $number):
// Assign variables within lloop
$bar =$numguest[0];
$foo = random($bar); // call random function to get a new random pic
$record = mysql_result($result,$foo,"ID");
$cat = mysql_result($result,$foo,"category");
$name = mysql_result($result,$foo,"picture_name");
$rating = mysql_result($result,$foo,"rating");
// $name = mysql_result($result,$i,"name");
?>
<TR bgcolor="#000000" ><TH><small>Name:<? echo "$name";
?> Record: <?
echo "$record"; ?> Category: <? echo "$cat"; ?> Rating: <? ec
ho "$rating"; ?>Total Records: <? echo $numguest[0]; ?>
</small></TH></TR>
<!-- <TR><TD> <? // echo "<img src=/graphics/uploads/$name width=$width
height=$height><br>\n"; ?> </TD></TR> -->
<TR bgcolor="#000000" ><TH>Random Number: <? echo "$foo"; ?>
Record: <?
echo "$record"; ?> Height= <? echo "$height"; ?> Width= <?
echo "$width"; ?></TH></TR>
</TR>
<?
$i++;
ENDWHILE;
//PRINT "</CENTER>";
ENDIF;
}
?>
</TABLE>
<!-- End database -->