Forum Moderators: open

Message Too Old, No Replies

ASP: Making a dynamic variable?

Like UserID_ & rs("ID") = "shown" or something?

         

KawaGPZ

12:34 pm on May 13, 2005 (gmt 0)

10+ Year Member



Hi,

(first post here :) )

I need to make a dynamic variable, but I cant seem to make it work.

I loop trough a list of users yada yada yada - long story short, I need to make a variable based upon their ID (or something else unique - ID preferable), so I can check later on in the loop, if that ID has already been shown on the list, or not.

I was thinking...


SELECT * FROM .......
do while not rs.eof

response.write "user: " ....

'now we need to save info that this user already HAS been shown, so that it won't be shown later down the list - was thinking something like this:

ID_& rs("ID") = "shown"

rs.movenext
loop

Then I want to simply add the following in the above "do while not rs.eof" :


If ID_&rs("ID")<>"shown" then
' then we show the user
end if

I know that ID_&rs("ID") is the wrong way to create the variable (hence it doesn't work) - so how do I do?

Thanks.

IanTurner

1:32 pm on May 13, 2005 (gmt 0)

WebmasterWorld Administrator 10+ Year Member Top Contributors Of The Month



Why not use a session variable

e.g.

Session("ID" & RS("ID")) = "shown"

If Session("ID" & RS("ID")) <> "shown" then
Do processing
End if

KawaGPZ

2:00 pm on May 13, 2005 (gmt 0)

10+ Year Member



There's 5,000 users it has to go trough - so that will mean 5,000 sessions - won't that be too harsh on the server? or is it the same with normal variables?

mrMister

3:49 pm on May 13, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



It's friday afternoon, so I've had a few drinks and can't read your code.

However it sound's like you're in need of a hash table. Doesn't ASP have a dictionary object that you can use to do this job?

KawaGPZ

8:13 pm on May 13, 2005 (gmt 0)

10+ Year Member



mrMister, I don't know what a hash table is, so Im not entirely sure if ASP has it or not :(