Designer Network Forum Index
Search  | Register | Log in
     Register | Log in Log in to check your private messages


Post new topic  Reply to topic
 ASP problems in IF statement ? « View previous topic :: View next topic » 
Author Message
andysears1
PostPosted: Mon Nov 21, 2005 11:56 pm    Post subject: ASP problems in IF statement ? Reply with quote



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
View user's profile Send private message Visit poster's website
Lafinboy
PostPosted: Sun Nov 27, 2005 1:43 am    Post subject: Reply with quote



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
View user's profile Send private message Visit poster's website AIM Address Yahoo Messenger MSN Messenger
andysears1
PostPosted: Mon Nov 28, 2005 8:55 am    Post subject: Reply with quote



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
View user's profile Send private message Visit poster's website
Lafinboy
PostPosted: Mon Nov 28, 2005 9:53 am    Post subject: Reply with quote



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 Question
_________________
Scott Swabey
Design & Development Director


Lafinboy Productions
Back to top
View user's profile Send private message Visit poster's website AIM Address Yahoo Messenger MSN Messenger
Display posts from previous:   
Post new topic  Reply to topic Page 1 of 1

Jump to:  



You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum






Better Business Bearu

Copyright 2005 Cider Media, Inc. All Rights Reserved.

Template created by Dustin Baccetti