Submit Your Article Forum Rules

Results 1 to 4 of 4

Thread: Coding Help Needed Nothing Big I Hope

  1. #1
    Junior Member
    Join Date
    Sep 2008
    Posts
    18

    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";
        }

  2. #2
    Member
    Join Date
    Nov 2006
    Posts
    64

    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

  3. #3
    Senior Member
    Join Date
    Dec 2007
    Posts
    212

    Re: Coding Help Needed Nothing Big I Hope

    Or try this:
    Code:
    $display = 1;
    
    if ( $display != 1 && $display != 2 )
        {
        echo "error";
        }
    Jean-Luc
    200ok.eu Broken Link Checker finds 404 errors, error pages with 200 ok status, missing images, protocol errors, password protected pages, bad domain names, redirect loops, parking pages, ...

  4. #4
    Junior Member
    Join Date
    Sep 2008
    Posts
    18

    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 ??

Similar Threads

  1. Yes You Can . . . and I Hope You Will
    By CyndiA in forum Submit Your Site For Review
    Replies: 2
    Last Post: 11-01-2008, 07:40 PM
  2. Hope this comes through
    By Belltoons in forum Member Photos
    Replies: 2
    Last Post: 05-10-2004, 11:17 AM
  3. Have a little Hope
    By wenwilder in forum The Castle Breakroom (General: Any Topic)
    Replies: 2
    Last Post: 03-03-2004, 06:48 PM
  4. here's my pic I hope I did it right;)
    By Ne0 in forum Member Photos
    Replies: 4
    Last Post: 02-06-2004, 07:54 PM
  5. New and I can help you (I hope)
    By Work Ally in forum Introductions
    Replies: 1
    Last Post: 01-05-2004, 09:37 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •