Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Image Rotator

Status
Not open for further replies.

rizza

Programmer
Jul 16, 2002
66
US
I've got this CurrentEvents Page on our company intranet site, where we have a list of all "Monthly Stuf".

There is a banner displayed for the current event. The selected banner is figured out based upon a db query. and the image name is taken from a field in that query.

My problem is if events overlap there are multiple banners in my recordset. they would like to make the images rotate.

All the banner scripts i've seen hardcode the links to the banners, and they just seem like to much for my little task.

Is there an easy(relatively speaking of course) way to do this????

Thanks to all that help people out.
Rizza
 
Not sure I understand exactly how you are doing it.. but I know you could use RAND in your sql statement..


Select * From table_name Where id=45 Order by id Rand() Limit 0,1 www.vzio.com
ASP WEB DEVELOPMENT



 
I cannot use random because i'm not selecting one CurrentEvent.

I need to basically load all CurrentEvents that fall in a date range.

Then take those events and display their banner for x seconds, getting there file links from

<% rs.Fields(&quot;FileLink&quot;) %>


Hope this clears it up
 


Loop through each ID, and put them in to a string, seperated by a chr such as | ...
Code:
 Do while not rs.eof
   strALLids = strALLids & &quot;|&quot; & rs(&quot;id&quot;)
 rs.movenext
 loop

the split them into an array...

Code:
strALLidsSplit = Split(strALLids, &quot;|&quot;)

Then randomly select a number for the array...

Code:
randomize
strRanNum=int(rnd*uBound(strALLidsSplit))+1

Then use this to call that record so you can get the link...
Code:
Response.Write(strALLidsSplit(strRanNum))

- Jason
www.vzio.com
ASP WEB DEVELOPMENT



 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top