Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 6 of 6
  1. #1
    New Coder
    Join Date
    Nov 2003
    Posts
    65
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Code problem with "greater than or equal to"

    I am using the following code to hide forum categories from low level users, but it isn't working.

    Code:
    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

  • #2
    raf
    raf is offline
    Master Coder
    Join Date
    Jul 2002
    Posts
    6,589
    Thanks
    0
    Thanked 0 Times in 0 Posts
    If intGroupID => CInt(objRs2("forum_sub_cat_read")) Then
    should be
    If intGroupID >= CInt(objRs2("forum_sub_cat_read")) Then

  • #3
    New Coder
    Join Date
    Nov 2003
    Posts
    65
    Thanks
    1
    Thanked 0 Times in 0 Posts
    Yeah I had that to start with, and it wasn't working either.

  • #4
    raf
    raf is offline
    Master Coder
    Join Date
    Jul 2002
    Posts
    6,589
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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)

  • #5
    New Coder
    Join Date
    Nov 2003
    Posts
    65
    Thanks
    1
    Thanked 0 Times in 0 Posts
    Printing the values made me realise the If... Then satement was in the wrong place... it looked right to me?!

    Thanks for the help, and the coding tip!

  • #6
    raf
    raf is offline
    Master Coder
    Join Date
    Jul 2002
    Posts
    6,589
    Thanks
    0
    Thanked 0 Times in 0 Posts
    No problem. Glad you got it working !


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •