WHAT THE !!! < and > with variables

Page 1 of 2 12 LastLast
Results 1 to 10 of 11

Thread: WHAT THE !!! < and > with variables

  1. #1
    Newbie Confused Guest

    Default WHAT THE !!! < and > with variables

    My code has two variables. Let say varss = 1400 and vartt = 1500<BR>(these variables can be any number that a user enters)<BR><BR>My code:<BR><BR>strdiff = vartt - 50<BR>if strdiff &#060; varss then<BR>response.write varss<BR>Response.Write vared<BR>end if<BR><BR>Why wont this work?!!!! It acts as if strdiff is &#062; than varss and wont write out the variables.<BR><BR>Thanks<BR>VERY CONFUSED!<BR>

  2. #2
    John Weeflaar Guest

    Default RE: WHAT THE !!! < and > with variables

    Try This:<BR>strdiff = CInt(vartt) - 50<BR>if strdiff &#060; CInt(varss) then<BR>response.write varss<BR>Response.Write vared<BR>end if<BR><BR>Cheers,<BR><BR>John

  3. #3
    Still Confused Guest

    Default Still Doesnt Work??? Im Using VBscript?

    I tried using the CInt(vartt) stuff and still acts as tough the larger number is &#060; the other when in the response.write shows the exact oppisite. i am using VBscript in my ASP pages if that matters.<BR><BR>Any other ideas? Please!!!

  4. #4
    John Weeflaar Guest

    Default RE: Still Doesnt Work??? Im Using VBscript?

    Well, if varss = 1400, vartt = 1500<BR>strdiff = vartt - 50 = 1450<BR>and 1450 can never be &#060; 1400, and so the statement after<BR>the condition never gets executed.<BR>Try: varss = 1400, vartt = 1300<BR>Then, it should do the Response.Write<BR>If this doen&#039t answer, then I need to see your other code.<BR><BR>Cheers,<BR><BR>John

  5. #5
    kirk@talkvisual.com Guest

    Default Wierd!!! Still Doesnt Work???

    I posted the code at this address:<BR>http://www.te-ve.com/resvcode.htm<BR><BR>page will just show up as blank when you get there, you will have to hit "View Source Code" to see the ASP code. <BR><BR>Let converse through e-mail if thats alright?<BR><BR>Mine is kirk@talkvisual.com<BR><BR>Thanks a bunch

  6. #6
    Join Date
    Dec 1969

    Default RE: WHAT THE !!! < and > with variables

    varss = 1400<BR>vartt = 1500<BR><BR>strdiff = vartt - 50<BR><BR>In this case strdiff = 1450 and 1450 &#062; 1400 so the response.write(s) will not be performed...<BR><BR>

  7. #7
    rupali Guest

    Default RE: WHAT THE !!! < and > with variables

    If you are using just &#062; or &#060; signs it sometimes creates problem.<BR>Try using &#062;= or &#060;= signs.<BR> Hope it helps.<BR> Bye

  8. #8
    omc Guest

    Default Check your math!

    I think this is just a math problem, not a script problem. <BR>strdiff=1450<BR>varss=1400<BR>so strdiff is not smaller than varss.<BR><BR>The code is working correctly.

  9. #9
    Newbie Confused Guest

    Default RE: Check your math!

    I know my math is not wrong. I am having trouble with variables.<BR>My code really looks like this:<BR><BR>&#060;%<BR>strtimdif = stretim - 50<BR><BR>if strtimdif &#060; strtim then<BR>Response.Redirect "../wrongtimediff.htm"<BR>end if<BR>%&#062;<BR><BR>stretim = the end time of a reservation<BR>strtim = the start time of a reservation<BR><BR>all resevations must be 30mins in length (50 in military time)<BR>I am trying to determine if the call is at least 30mins, if not then redirect to error page.<BR><BR>I put response write so I could visually see what was coming up. No matter what the number it always acts if strtimdif is less than the start time?

  10. #10
    omc Guest

    Default RE: Check your math!

    I ran this code through and it worked: <BR>&#060;%<BR>stretim=1400<BR>strtimdif = cint(stretim)-50<BR><BR>if strtimdif &#060; stretim then<BR>response.write "I&#039m in&#060;p&#062;strtimdif: " & strtimdif & "<BR>"<BR>response.write "stretim: " & stretim & "<BR>"<BR>end if<BR>%&#062;<BR><BR>see if that works. The only thing that is significantly different is the use of cint().

Posting Permissions

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