Web Wiz - Green Windows Web Hosting

  New Posts New Posts RSS Feed - If then else statement using ’OR’
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

If then else statement using ’OR’

 Post Reply Post Reply
Author
Agni View Drop Down
Newbie
Newbie


Joined: 02 July 2004
Location: Greece
Status: Offline
Points: 37
Post Options Post Options   Thanks (0) Thanks(0)   Quote Agni Quote  Post ReplyReply Direct Link To This Post Topic: If then else statement using ’OR’
    Posted: 02 July 2004 at 11:18am

I am trying to write an if else statement, but with an or condition as follows (which doesn't work!) 

If strCategory="Corfu" or "Site Admin" then

...

End If 

 

Any sugestions would be very helpful.

Thanks

Nathan

 

Back to Top
zaboss View Drop Down
Senior Member
Senior Member


Joined: 20 August 2002
Location: Romania
Status: Offline
Points: 454
Post Options Post Options   Thanks (0) Thanks(0)   Quote zaboss Quote  Post ReplyReply Direct Link To This Post Posted: 02 July 2004 at 11:20am

If strCategory="Corfu" or strCategory="Site Admin" then



Edited by zaboss
Cristian Banu
Soft 4 web
Back to Top
Semikolon View Drop Down
Senior Member
Senior Member


Joined: 09 September 2003
Location: Norway
Status: Offline
Points: 1718
Post Options Post Options   Thanks (0) Thanks(0)   Quote Semikolon Quote  Post ReplyReply Direct Link To This Post Posted: 02 July 2004 at 11:26am
are you the same Nathan that has been here before? the one who drinks beer and hosts with JH?

You have to use the variable between all operators like zaboss wrote..

If intVariable = 1 OR intVariable = 2 AND intVariable2 = 5 THEN
Back to Top
Gullanian View Drop Down
Senior Member
Senior Member
Avatar

Joined: 04 January 2002
Location: England
Status: Offline
Points: 4373
Post Options Post Options   Thanks (0) Thanks(0)   Quote Gullanian Quote  Post ReplyReply Direct Link To This Post Posted: 02 July 2004 at 11:39am
Using () helps when mixing ORS with ANDS
Back to Top
Semikolon View Drop Down
Senior Member
Senior Member


Joined: 09 September 2003
Location: Norway
Status: Offline
Points: 1718
Post Options Post Options   Thanks (0) Thanks(0)   Quote Semikolon Quote  Post ReplyReply Direct Link To This Post Posted: 02 July 2004 at 11:41am
shoot.. forgot..

If you want it to be either var 1 = 1 Or var1 = 2 and var 2 = 5 then you have to do it like this:

If intVariable = 1 OR (intVariable = 2 AND intVariable2 = 5) THEN
Back to Top
Agni View Drop Down
Newbie
Newbie


Joined: 02 July 2004
Location: Greece
Status: Offline
Points: 37
Post Options Post Options   Thanks (0) Thanks(0)   Quote Agni Quote  Post ReplyReply Direct Link To This Post Posted: 02 July 2004 at 12:00pm

Yes correct SemiKolon. I tried a while back to change my email address in my profile, but must have incorrectly entered it as it does not send me an activation email - so I am unable to log into my old account.

Re Beer - yep I drink loads - especially after Greece winning the football last night!

RE coding -

if strCategory="Corfu - Greece" then

(works fine)

 If strCategory="Corfu" or strCategory="Site Admin" then

(throws an error)

Not sure why, and I cannot tell you which error it is throwing as all error codes display my site map page!

Any help would be very welcome.

Nathan

 

Back to Top
Semikolon View Drop Down
Senior Member
Senior Member


Joined: 09 September 2003
Location: Norway
Status: Offline
Points: 1718
Post Options Post Options   Thanks (0) Thanks(0)   Quote Semikolon Quote  Post ReplyReply Direct Link To This Post Posted: 02 July 2004 at 12:17pm
try if strCategory="Corfu - Greece" or strCategory="Site Admin" then then
Back to Top
Agni View Drop Down
Newbie
Newbie


Joined: 02 July 2004
Location: Greece
Status: Offline
Points: 37
Post Options Post Options   Thanks (0) Thanks(0)   Quote Agni Quote  Post ReplyReply Direct Link To This Post Posted: 02 July 2004 at 4:31pm

Thanks - my fault sorry - the problem is not with the expression, but the coding run when the if statement is true! - Thanks for all you help though - again I owe everyone beers!

Cheers

Nathan

Taverna Agni, Corfu

Back to Top
 Post Reply Post Reply

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.08
Copyright ©2001-2026 Web Wiz Ltd.


Become a Fan on Facebook Follow us on X Connect with us on LinkedIn Web Wiz Blogs
About Web Wiz | Contact Web Wiz | Terms & Conditions | Cookies | Privacy Notice

Web Wiz is the trading name of Web Wiz Ltd. Company registration No. 05977755. Registered in England and Wales.
Registered office: Web Wiz Ltd, Unit 18, The Glenmore Centre, Fancy Road, Poole, Dorset, BH12 4FB, UK.

Prices exclude VAT at 20% unless otherwise stated. VAT No. GB988999105 - $, € prices shown as a guideline only.

Copyright ©2001-2026 Web Wiz Ltd. All rights reserved.