PHP Where Problem

Discussion in 'PHP' started by Pixel T., Jul 3, 2010.

  1. #1
    Hey guys,

    I have a form which gets an age range for example from 18 to 30. I have a database full of users and I want to narrow down only the users from the ages of 18 to 30.

    Is there any where to write something like this

    SELECT * FROM `users` WHERE age='18' TO '30' ?

    Or something similar to this?

    Thanks,
    Cezary
     
    Pixel T., Jul 3, 2010 IP
  2. Rainulf

    Rainulf Active Member

    Messages:
    373
    Likes Received:
    12
    Best Answers:
    0
    Trophy Points:
    85
    #2
    I think it's something like this:
    SELECT * FROM `users` WHERE age>='18' AND age <= '30'
     
    Rainulf, Jul 3, 2010 IP
  3. Pixel T.

    Pixel T. Well-Known Member

    Messages:
    1,205
    Likes Received:
    13
    Best Answers:
    0
    Trophy Points:
    170
    #3
    Works perfectly. Thanks :)
     
    Pixel T., Jul 3, 2010 IP