Subscript out of range: 'ticker' ?????

D

David

Hi, I have the following asp in my page, but I keep getting the
following error

Microsoft VBScript runtime error '800a0009'

Subscript out of range: 'ticker'

Please can you help me ?. Here is the page code I have so far:
---------------------------------


<%
Randomize
R=clng(1E6*rnd)
F=1+clng(1E3*rnd)

Dim RS_rand
Set RS_rand = Server.CreateObject("ADODB.Recordset")
RS_rand.ActiveConnection = conn_string
RS_rand.Source = "SELECT TOP 2 * FROM products WHERE product_New = 1
ORDER BY ((product_ID * " & F & "+" & R & ")Mod 1000);"
RS_rand.CursorType = 0
RS_rand.CursorLocation = 2
RS_rand.LockType = 1
RS_rand.Open()

Dim prodArray(3,2)
ID_CODE = 0
THUMB_CODE = 1
DESC_CODE = 2
URL_CODE = 3

ticker = -1

If NOT (RS_rand.EOF) OR NOT(RS_rand.BOF) then
While NOT RS_rand.EOF
ticker = ticker + 1

prodArray(ID_CODE, ticker) = RS_rand("product_ID")
prodArray(THUMB_CODE,ticker) = RS_rand("product_Thumb")

p_desc = RS_rand("product_Description_2")
if IsNull(p_desc) then
p_desc = RS_rand("product_Description")
end if
if (Len(p_desc) >= 60 ) then
space_pos = InStr(120, p_desc, " ") - 1
p_desc = Left(p_desc, space_pos) & "..."
end if
prodArray(DESC_CODE,ticker) = p_desc

Set RS_URL = Server.CreateObject("ADODB.Recordset")
RS_URL.ActiveConnection = conn_string
SQL = "SELECT category_URL FROM categories WHERE category_ID = " &
RS_rand("category_ID")
RS_URL.Source = SQL
RS_URL.Open()

prodArray(URL_CODE,ticker) = RS_URL("category_URL")

RS_URL.Close()
Set RS_URL = Nothing
RS_rand.MoveNext
WEnd
End If

RS_rand.Close()
Set RS_rand = Nothing

' Super. We have the info in our array. Now let's make the html:
Dim RandomBox(3)
for i = 0 to ticker step 1
RandomBox(i) = "<div class=""imgholder""><img
src=""../product-images/" & prodArray(THUMB_CODE,i) & """ alt=""""
width=""125"" /></div>"
RandomBox(i) = RandomBox(i) & "<a href=""../" & prodArray(URL_CODE,i)
& "/product.asp?ID=" & prodArray(ID_CODE,i) & """>" &
prodArray(DESC_CODE, i) & " <span class=""obvious"">read more<i>
&raquo;</i></span></a>"
next

%>
 
A

Anthony Jones

David said:
Hi, I have the following asp in my page, but I keep getting the
following error

Microsoft VBScript runtime error '800a0009'

Subscript out of range: 'ticker'

Please can you help me ?. Here is the page code I have so far:

Can't see anything obvious. Which Database are you using? It looks like
you are doing a lot of work in Script that you should be doing in SQL
instead resulting a much simpler ASP.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,766
Messages
2,569,569
Members
45,043
Latest member
CannalabsCBDReview

Latest Threads

Top