General Programming Help
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
User Name:
Password:
Remember me
 



Go Back   Dev Articles Community ForumsProgrammingGeneral Programming Help

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Display Modes
 
Unread Dev Articles Community Forums Sponsor:
  #1  
Old January 28th, 2004, 08:14 PM
aron aron is offline
Contributing User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jan 2004
Location: brisbane
Posts: 42 aron User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 2 h 9 m 35 sec
Reputation Power: 15
"IF" and multiple "OR" "||" statement help???

is this correct

<? if ($line["type"] == 'Farm' || $line["type"] == 'Farmlet' || $line["type"] == 'Rural' $line["type"] == 'House'){ ?> style="display:" <? } ?>

cheers aron.

Reply With Quote
  #2  
Old January 28th, 2004, 09:29 PM
Bruski Bruski is offline
Contributing User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jul 2003
Location: Toronto, Canada
Posts: 192 Bruski User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 15
i think there is an easier way to do this since you are testing the same variable

PHP Code:
if ($line["type"] == ('Farm' || 'Farmlet' || 'Rural')) 

other than that, it looks correct

Reply With Quote
  #3  
Old January 28th, 2004, 09:30 PM
FrankieShakes FrankieShakes is offline
Frank The Tank!
Dev Articles Beginner (1000 - 1499 posts)
 
Join Date: Jun 2002
Location: Toronto, Canada
Posts: 1,240 FrankieShakes User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 17
Send a message via ICQ to FrankieShakes Send a message via MSN to FrankieShakes
Aron,

Bruski gave a good response... I noticed, however, that in your code, you were missing a final "||" check between:

$line["type"] == 'Rural'

and

$line["type"] == 'House'

I'd definitely go with Bruski's advice... Also, I would suggest using the long form of opening PHP tags (<?php) rather than the short, as you'll increase your application's portability by doing so.

Reply With Quote
  #4  
Old February 10th, 2004, 05:30 PM
osfdeath osfdeath is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Feb 2004
Posts: 1 osfdeath User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
How would I go about doing something simular in a DB query?
In this case pf.field has many variables - I only want 3 of them to be selected...(Active1 or Active2 or Active3)
PHP Code:
 $sql mysql_query("SELECT m.name, pf.field_3, pf.field_17, pf.field_18 FROM ibf_members AS m LEFT OUTER JOIN ibf_pfields_content AS pf ON m.id = pf.member_id WHERE pf.field_18='$state' AND pf.field_17='Active1' OR pf.field_17='Active2' OR pf.field_17='Active3' ORDER BY m.name "); 

Reply With Quote
Reply

Viewing: Dev Articles Community ForumsProgrammingGeneral Programming Help > "IF" and multiple "OR" "||" statement help???


Developer Shed Advertisers and Affiliates


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 


Powered by: vBulletin Version 3.0.5
Copyright ©2000 - 2018, Jelsoft Enterprises Ltd.

© 2003-2018 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap