...

View Full Version : greater than and less than



scroots
02-23-2003, 04:31 PM
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

whammy
02-23-2003, 08:25 PM
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

scroots
02-24-2003, 08:32 PM
thanks whammy i shall try asigning it to a tempory variable.

thanks

scroots



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum