...

View Full Version : Code problem with "greater than or equal to"



r0ck1t
12-08-2003, 03:22 AM
I am using the following code to hide forum categories from low level users, but it isn't working.



If intGroupID => CInt(objRs2("forum_sub_cat_read")) Then
Response.Write("")
Else
Response.Write("")
End If


The guest account has a Group ID of 1, and I have forums set at 3, 4, and 5 that are viewable by a guest.

Is there a problem with that code?

http://www.gympieyouth.com/forum_default.asp

raf
12-08-2003, 10:42 AM
If intGroupID => CInt(objRs2("forum_sub_cat_read")) Then
should be
If intGroupID >= CInt(objRs2("forum_sub_cat_read")) Then

r0ck1t
12-08-2003, 11:24 AM
Yeah I had that to start with, and it wasn't working either.

raf
12-08-2003, 01:15 PM
Plan b:
or you sure that intGroupID contains a value + that it is a numerical variable? (if it's a string, then > will check on the stringlength. As in 'if "100" > "23.256"' will return false.

Try
If (CInt(intGroupI) >= CInt(objRs2("forum_sub_cat_read"))) Then

Plan c:
or you sure that objRs2("forum_sub_cat_read") contains a value?
It's also better to refer to recordsetvalues like
objRs2.Fields("forum_sub_cat_read").Value

Plan d:
print both values like
response.write("intGroupI = " & intGroupI & "<br />objRs2("forum_sub_cat_read") = " & objRs2.Fields("forum_sub_cat_read").Value)

r0ck1t
12-09-2003, 06:03 AM
Printing the values made me realise the If... Then satement was in the wrong place... it looked right to me?! :D

Thanks for the help, and the coding tip!

raf
12-09-2003, 07:37 PM
No problem. Glad you got it working !



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum