iEntry 10th Anniversary Forum Rules Search
WebProWorld
Register FAQ Calendar Mark Forums Read
Web Programming Discussion Forum Working with an API? Developing a plugin? Writing a Mod or script for your favorite blog, Web 2.0 site or Forum? Welcome.

Share Thread: & Tags

Share Thread:

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 10-16-2008, 08:26 PM
WebProWorld New Member
 
Join Date: Sep 2008
Posts: 18
ryanhouston RepRank 0
Lightbulb Coding Help Needed Nothing Big I Hope

Hello i am using the following code to display a message if a variable is not equal to 1 or 2 if this is not equal it displays an error but if it is equal it does nothing. The code below shows the error never mind what the value is this isn't what i want.

Code:
$display = 1;

if ($display !== 1 || 2)
    {
    echo "error";
    }
Reply With Quote
  #2 (permalink)  
Old 10-16-2008, 09:25 PM
WebProWorld Member
 
Join Date: Nov 2006
Location: Seattle
Posts: 64
shannonlp RepRank 0
Default Re: Coding Help Needed Nothing Big I Hope

Try this

<code>

$display_test = 1;

switch ($display_test) {
case 1:
echo 'no error';
break;

case 2:
echo 'no error';
break;

default:
echo 'error';
break;
}
</code>
__________________
Web Designer and Custom Spider Creator
eCommerce and shopping cart information
Reply With Quote
  #3 (permalink)  
Old 10-17-2008, 05:03 AM
WebProWorld Pro
 
Join Date: Dec 2007
Location: Brussels, Belgium
Posts: 164
Jean-Luc RepRank 2
Default Re: Coding Help Needed Nothing Big I Hope

Or try this:
Code:
$display = 1;

if ( $display != 1 && $display != 2 )
    {
    echo "error";
    }
Jean-Luc
__________________
Checking redirects made easy | | Professional AWStats Services
Reply With Quote
  #4 (permalink)  
Old 10-17-2008, 08:19 AM
WebProWorld New Member
 
Join Date: Sep 2008
Posts: 18
ryanhouston RepRank 0
Default Re: Coding Help Needed Nothing Big I Hope

Quote:
Originally Posted by Jean-Luc View Post
Or try this:
Code:
$display = 1;

if ( $display != 1 && $display != 2 )
    {
    echo "error";
    }
Jean-Luc
Thank you very much for this piece of code do you have msn ??
Reply With Quote
Reply

  WebProWorld > Webmaster, IT and Security Discussion > Web Programming Discussion Forum

Thread Tools
Display Modes

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

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Hope This Helps ctabuk Search Engine Optimization Forum 0 10-30-2004 10:58 AM
Hope this comes through Belltoons Member Photos 2 05-10-2004 12:17 PM
Have a little Hope wenwilder The Castle Breakroom (General: Any Topic) 2 03-03-2004 07:48 PM
here's my pic I hope I did it right;) Ne0 Member Photos 4 02-06-2004 08:54 PM
New and I can help you (I hope) Work Ally Introductions 1 01-05-2004 10:37 AM


All times are GMT -4. The time now is 02:36 PM.



Search Engine Optimization by vBSEO 3.3.0