Hello and welcome to our community! Is this your first visit?
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    New to the CF scene
    Join Date
    Apr 2004
    Thanked 0 Times in 0 Posts

    Matching two variables question

    Ok so I have the following:

    <% IF RS("appealID") = request.querystring("appealID") THEN Response.Write "TRUE" END IF%>

    I know for a fact that RS("appealID") is the same as the querystring but nothing is getting printed however when I type in the query string staticly like so:

    <% IF RS("appealID") = "160" THEN Response.Write "TRUE" END IF%>

    It works.

    I know that both variables are being carried but I don't know why this will not work.

    Any help will be greatly appreciated.

  • #2
    Senior Coder Morgoth's Avatar
    Join Date
    Jun 2002
    Ontario, Canada Remaining Brain Cells: 6
    Thanked 1 Time in 1 Post
    You need the Int() function to make sure the value you type into the query is really an integer.

    Right now it's a string; Let's say RS("appealID") = "apple" and request.querystring("appealID") = "apple", (page.asp?appealID=apple) this would equal True.
    <% If RS("appealID") = int(Request.QueryString("appealID")) Then Response.Write "TRUE" End If%>
    Be warned when using Query Strings to get ID numbers, if a user changes them they can act as a way to gey permission to do this they should not, or to change results in a database they should not.



    Posting Permissions

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