| Author |
Message
|
| andysears1 |
Posted: Mon Nov 21, 2005 11:56 pm Post subject: ASP problems in IF statement ? |
|
|

Joined: 11 Nov 2005 Posts: 140 Location: Herts UK
|
OK this is niggling me....anyone?
this works...
<% If request.querystring("pid") < 10 THEN %>
Show this text
<%END IF%>
But... I need the 10 to be a variable i.e...
<% session("pict") = 10 %>
<% If request.querystring("pid") < session("pict") THEN %>
Show this text
<%END IF%>
Both these statements should be identical apart from the session variable used. The first statement works fine. the second never does.
Any ideas? _________________ Andy
_____________________________________
http://www.sears-online.co.uk/ - Local web design at realistic prices.
you want to charge me how much???? |
|
| Back to top |
|
 |
| Lafinboy |
Posted: Sun Nov 27, 2005 1:43 am Post subject: |
|
|

Joined: 10 Nov 2005 Posts: 23 Location: Sydney, Australia
|
If you are declaring the session variable on a page, and then trying to use the value of that session variable on the same page at the same time that you declare it, then it will never work. The page will need to be reloaded for the session variable to be entered into memory.
If the assignment and use of the session variable values are on different pages then you may be hitting a datatype issue. Try declaring your values as integer datatypes, like:
| Code: |
<% If cInt(request.querystring("pid")) < cInt(session("pict")) THEN %>
Show this text
<%END IF%> |
_________________ Scott Swabey
Design & Development Director
Lafinboy Productions |
|
| Back to top |
|
 |
| andysears1 |
Posted: Mon Nov 28, 2005 8:55 am Post subject: |
|
|

Joined: 11 Nov 2005 Posts: 140 Location: Herts UK
|
OK I had already sussed it, it was the request.querystring that was being handled as string by default. Should have guessed that I suppose, but in all honesty had never had the problem before.
As for declaring the session variable that was just shown like that for the purpose of the post, it is infact declared bedfore the HEAD so before page is output.
Cheers anyway, on being the only one to answer, all the others must be PHPer's _________________ Andy
_____________________________________
http://www.sears-online.co.uk/ - Local web design at realistic prices.
you want to charge me how much???? |
|
| Back to top |
|
 |
| Lafinboy |
Posted: Mon Nov 28, 2005 9:53 am Post subject: |
|
|

Joined: 10 Nov 2005 Posts: 23 Location: Sydney, Australia
|
No worries. If I wasn't so busy with work you would have had an answer much earlier.
I guess I'm one of the few that has the luck to be involved heavily in both ASP and PHP  _________________ Scott Swabey
Design & Development Director
Lafinboy Productions |
|
| Back to top |
|
 |
|
|