Skip to main content
Participant
August 8, 2008
Question

Randon Records

  • August 8, 2008
  • 2 replies
  • 224 views
I am very new to PHP, Until now I have been simply a designer and delved mainly in the graphical end of web design. I have my own web site I am building and am trying to figure out how to get something to work.

I have an area where I want to display three random thumb nails (I have them stored as thumbs PHP does not need to resize them). I am pulling the the jpeg name from my database. I have gotten it to sort of work. Its displaying 3 pictures. Its does randomize when I refresh, however all three images are the same. How can I get it to display 3 different images randomly?

I would Appreiate any help

My SQL Code is as follows:
This topic has been closed for replies.

2 replies

Participant
August 8, 2008
Thank You So Much!!

Now all I have to do is get them Linked LOL
Inspiring
August 8, 2008
Rabastan99 wrote:
> Its displaying 3
> pictures. Its does randomize when I refresh, however all three images are the
> same. How can I get it to display 3 different images randomly?

You're displaying only the first result. Instead of hard-coding three
images into your table cell, you need to insert one, and apply a repeat
region to the dynamic placeholder.


<td width="415" height="125" colspan="4" rowspan="4" align="center"
valign="middle" bgcolor="#151822">

<?php do } ?> // repeat region starts here
<img src="<?php echo $row_rsHIGHLIGHTS['websiteTHUMB']; ?>"
alt="random image">
<?php while ($row_rsHIGHLIGHTS = mysql_fetch_assoc($rsHIGHLIGHTS)); ?>

</td>

--
David Powers, Adobe Community Expert
Author, "The Essential Guide to Dreamweaver CS3" (friends of ED)
Author, "PHP Solutions" (friends of ED)
http://foundationphp.com/
Participant
August 8, 2008
Thanks for the reply,

I tried a repeat region before, it insisted on laying them out vertically. I need them horizontal. I did try to copy and paste you code in and got a blank white page. I added code to show errors at the top of the page and got nothing.

Jon