PDA

Click to See Complete Forum and Search --> : Banner Add Rotation Program Help


HakanAzaklioglu
Jun 6th, 2001, 03:31 PM
I have some code that allows me to display a banner but I need to display multiple banners on the same page instead of just one and have them randomly rotate on page refresh only.

Code Sample
=======================================
<%@ Language=VBScript %>

<%
set conn = server.createobject ("adodb.connection")
conn.open "ADROTATE"
set RSTopNumber = conn.Execute("select Max(BannerAdID) as MaxID from GTBannerAds")
Randomize
RecordNumber = Int(RSTopNumber("MaxID") * Rnd + 1)
set RSImage = conn.Execute("select * from GTBannerAds " _
& "where BannerAdID = " & RecordNumber)
conn.Execute "insert into GTBannerAdImps (BannerAdID, WhenHit) values (" _& RecordNumber & ", '" & Now & "')"
%>
=======================================


Here is the kind of code I would like to have in the body of the page
=======================================
<TABLE BORDER=0 CELLSPACING=0 CELLPADDING=0 align="center">
<TR VALIGN="top" ALIGN="left"><%DO UNTIL RSImage.EOF%>
<TD colspan="2" ALIGN="left" VALIGN="top"><A HREF="./router.asp?BannerADID=<% Response.Write RSImage("BannerAdID") %>"><IMG HEIGHT=69 WIDTH=439 SRC="<% Response.Write RSImage("Path2Image") %>" BORDER=0 ALT="<% Response.Write RSImage("ALTText") %>" ></A></TD>
</TR>
<%
RSImage.movenext
loop
%>
</TABLE>
=======================================

The next question is how can I limit the number of banners being displayed on the page for example if I had a database of 26 banners
I would like to have say 6 per page and then if the page is refreshed a different 6 display.

All help is appreciated

Kind Regards,
Hakan

HakanAzaklioglu
Jun 7th, 2001, 08:34 AM
Does anyone have any ideas?

Thank You
Hakan