[thelist] Re: Strange problem with ASP (random) (here is the code)

Chris Anderson ckanderson at powersurfr.com
Mon Jan 21 15:36:57 CST 2002


Obviously this must not make any sense to anyone either...

Can anyone help me start from scratch then in order to get something that
will work on EVERY page?  Thanks!

Christian Anderson

Photokyo - Digitally capturing the best Tokyo has to offer!
http://www.photokyo.com

----- Original Message -----
From: "Chris Anderson" <ckanderson at powersurfr.com>
To: <thelist at lists.evolt.org>
Sent: Sunday, January 20, 2002 5:52 PM
Subject: [thelist] Re: Strange problem with ASP (random) (here is the code)


> Ok, no laughing at my terrible coding... :)
>
> Maybe I should describe whats going on here...  remember, I didnt read any
> books, I just farted around on my own to get something that worked :)
>
> The SQL21 part is what first goes into the database to see how many lines
> there are in there.  It just keeps counting (randombookcounter) until it
> gets to EOF.  From there we have the number of lines in that table.
>
> Then I take a random number with the       pick_row88 =
> Int(Rnd*randombookcounter)       code.
>
> From there, the SQL22 part fires through the table till it gets to
whatever
> the random line number is, and pulls the data out.
>
> So why does it work on the main page and not the rest of them?  Thats the
> part that makes my brain hurt, and yours too Im guessing :)
>
> And the images that are displaying on those pages right now arent the
first
> in the databse.  They are from somewhere in the middle.
>
> ----------------
>
> <%
>       SQL21=("SELECT * FROM t_bookstore ORDER BY aID;")
>       set randombook=conn.execute(SQL21)
>       randombookcounter = 0
>       Do while NOT randombook.EOF
>       randombookcounter = randombookcounter + 1
>       randombook.MoveNext
>       loop
>       randombook.close
>       %>
>
>       <%
>       pick_row88 = Int(Rnd*randombookcounter)
>       %>
>
>       <%
>       SQL22=("SELECT * FROM t_bookstore ORDER BY aID;")
>       set randombookdisplay=conn.execute(SQL22)
>       rowcount5 = 0
>       Do while NOT rowcount5 = pick_row88
>       rowcount5 = rowcount5 + 1
>       randombookdisplay.MoveNext
>       loop
>       Response.Write "<center><a href=booklist.asp?category=" &
> randombookdisplay(2) & "><img border=0 src=" & randombookdisplay(1) &
> "></a></center>"
>       randombookdisplay.close
>       %>
>
> Christian Anderson
>
> Photokyo - Digitally capturing the best Tokyo has to offer!
> http://www.photokyo.com
>
>
> --
> For unsubscribe and other options, including
> the Tip Harvester and archive of TheList go to:
> http://lists.evolt.org Workers of the Web, evolt !
>





More information about the thelist mailing list