Forums

This topic is locked

comparing cookie value and database value

Posted 08 Jan 2003 22:48:41
1
has voted
08 Jan 2003 22:48:41 Matthijs Horsman posted:
Hello all,

Ok, i think i am losing it... Here's my problem;

I wanna compare a value (user id so it's a number) with a value out of the database (also the user id) using ASP/VB and ACCESS on WINXP

my code is:
<% if request.Cookies("FreesUID" = (rsTopics.Fields.Item("USER_ID".Value) then response.Write("yes"%>

Look's pretty normal i should say... but, i don;t get any "yes" in my screen... <img src=../images/dmxzone/forum/icon_smile_sad.gif border=0 align=middle>

When i just use &lt;% = request.Cookies("FreesUID" %&gt; and &lt;% = (rsTopics.Fields.Item("USER_ID".Value) %&gt; then they both display the same number...

Do i need a Ctrs or Len or something like that to make it work??

TIA
Matthijs


Matthijs
----------------
DWMX/W-XP-PRO/IIS/ASP-VB/MS-SQL

Replies

Replied 09 Jan 2003 01:18:36
09 Jan 2003 01:18:36 paul durbar replied:
Try formatting it as a proper if else end if statement. Your syntax looks alright though. Try:

&lt;%
dim usercookie
usercookie = Request.Cookies("FreesUID"
dim useridval
useridval = rsTopics.Fields.Item("USER_ID".Value
If usercookie &lt;&gt; useridval Then
Response.Write("NO"
Else
Response.Write("Yes"
End if
%&gt;
Replied 09 Jan 2003 10:26:50
09 Jan 2003 10:26:50 Matthijs Horsman replied:
I don't know why but Cstr worked...

thnx for help

Matthijs
----------------
DWMX/W-XP-PRO/IIS/ASP-VB/MS-SQL

Reply to this topic