how to set range of $_GET?

Discussion in 'PHP' started by khan11, Mar 11, 2008.

  1. #1
    Hello,

    I want to perform some action in a range of id.

    like:

    if($_GET['id'] is shown from 0 to 100) { echo "show this"; } else { echo "show that"; }
    PHP:
    is it possible to do it? if, then how?

    thanks..
     
    khan11, Mar 11, 2008 IP
  2. khan11

    khan11 Active Member

    Messages:
    615
    Likes Received:
    15
    Best Answers:
    0
    Trophy Points:
    58
    #2
    hello, i just tried this by myself.

    is it correct?

    $_GET['id'] = 1 < 100 {echo...}
     
    khan11, Mar 11, 2008 IP
  3. The Critic

    The Critic Peon

    Messages:
    392
    Likes Received:
    7
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Is this what you're looking for?

    
    if($_GET['id']>=0&&$_GET['id']<=100){echo 'this';}
    else{echo 'that';}
    
    PHP:
     
    The Critic, Mar 11, 2008 IP
  4. khan11

    khan11 Active Member

    Messages:
    615
    Likes Received:
    15
    Best Answers:
    0
    Trophy Points:
    58
    #4
    @ The Critic

    yea this code is also working for me, the one which i wrote also works, that had mistake of single = sign.

    thanks for quick response..
     
    khan11, Mar 11, 2008 IP