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 3 of 3
  1. #1
    Senior Coder
    Join Date
    Jun 2002
    Location
    UK
    Posts
    1,137
    Thanks
    0
    Thanked 0 Times in 0 Posts

    greater than and less than

    using an if statement how can i detect a number is between two values like.
    5 < rsGuestbook("NUM") <25

    I came up with the following code but it doesn`t work
    IF rsGuestbook("NUM") < 25 AND rsGuestbook("NUM") > 5 THEN
    response.write("<img border=""0"" src=""70.gif"" width=""5"" height=""5"">")
    END IF

    anyone got any ideas?

    scroots
    Spammers next time you spam me consider the implications:
    (1) that you will be persuaded by me(in a legitimate mannor)
    (2)It is worthless to you, when i have finished

  • #2
    Senior Coder
    Join Date
    Jun 2002
    Location
    41° 8' 52" N -95° 53' 31" W
    Posts
    3,660
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Do you want to avoid getting these values in the first place?

    If so, I'd put that in your SQL statement itself... like

    SELECT * FROM Guestbook WHERE NUM > 5 AND NUM < 25

    Otherwise, assign the number to a temporary variable... like:

    Dim NUM
    NUM = rsGuestbook("NUM")

    IF NUM > 5 AND NUM < 25 THEN
    response.write("<img border=""0"" src=""70.gif"" width=""5"" height=""5"">")
    END IF
    Former ASP Forum Moderator - I'm back!

    If you can teach yourself how to learn, you can learn anything. ;)

  • #3
    Senior Coder
    Join Date
    Jun 2002
    Location
    UK
    Posts
    1,137
    Thanks
    0
    Thanked 0 Times in 0 Posts
    thanks whammy i shall try asigning it to a tempory variable.

    thanks

    scroots
    Spammers next time you spam me consider the implications:
    (1) that you will be persuaded by me(in a legitimate mannor)
    (2)It is worthless to you, when i have finished


  •  

    Posting Permissions

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