SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Addict
    Join Date
    Jul 2002
    Location
    Sooner Nation
    Posts
    208
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Cant make OR work ||

    I cant get || to work the code

    PHP Code:
    if (($button <> "edit") || ($button <> "next") || ($button <> "prev"))
    {
    echo 
    "this sucks";
    $year date("Y");
    $day date("j");
    $month=date("n");
    }
    echo 
    $button
    I echoed this sucks to see if it actually enters the if and it returs "this sucks"

    here is the URL:
    http://www.domain.com/admin/add_cal_info.php?month=2&year=2005&button=next

    I tried it with the conditions in () and with out - Im about to start beating my head against the wall.
    The only function of business is to create customer value and to innovate. - Peter Drucker

  2. #2
    Umm. PHP Guru....Naaaah jaswinder_rana's Avatar
    Join Date
    Jul 2004
    Location
    canada
    Posts
    3,193
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    you using it the wrong way. use "&&" in this context. because what you want is if all of these are false then execute if.

    and WHAT YOU ARE DOING RIGHT NOW IS if any of these is false execute. so, in this context if will always execute no matter what.

    hope this is what you want


Bookmarks

Posting Permissions

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