Select Statement With Multiple Parameter Values

Discussion in 'Databases' started by bloard, Sep 16, 2008.

  1. #1
    I want to create a query where the parameter values are essentially OR options, but want to use values from a php array. It sounds confusing, but let me show you and you will understand. I want to do something like this:

    SELECT * from TABLENAME WHERE columnname =1 OR columname = 3 OR columname = 8 etc.

    it seems like I should just be able to do something like
    WHERE columnname = 1,3,8

    but that obviously doesn't work.

    Lets say that I have a php array with values of (1,3,8), how can I select the records from a column that have any of those values? I need a shorthand method because the values will be dynamic. What am I missing?
     
    bloard, Sep 16, 2008 IP
  2. bloard

    bloard Peon

    Messages:
    180
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #2
    Sorry, the above was a brain cramp post. Forgot about IN.
     
    bloard, Sep 16, 2008 IP