OR statement

Discussion in 'Programming' started by xamd404, Feb 25, 2011.

  1. #1
    Hello,

    Is there anyway to filter a recordset in PHP using an OR statement?

    for example:
    "SELECT * FROM DB1 WHERE example = %s"

    can i make it so it filters by 2? So something like:

    "SELECT * FROM DB1 WHERE example = %s or example2 = %s"
     
    xamd404, Feb 25, 2011 IP
  2. mastermunj

    mastermunj Well-Known Member

    Messages:
    687
    Likes Received:
    13
    Best Answers:
    0
    Trophy Points:
    110
    #2
    What output do you desire from query?

    Please share sample data with an example to help us write better query for you if its needed.
     
    mastermunj, Feb 25, 2011 IP
  3. jaydeee

    jaydeee Greenhorn

    Messages:
    91
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    16
    #3
    that is correct.
     
    jaydeee, Feb 26, 2011 IP
  4. xamd404

    xamd404 Peon

    Messages:
    20
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #4
    Thanks a lot i made a mistake somewhere else but yeh that does actually work lol.
     
    xamd404, Feb 26, 2011 IP
  5. marharri

    marharri Peon

    Messages:
    53
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #5
    Is it just me or does that "PHP" look a whole lot like SQL?
     
    marharri, Feb 26, 2011 IP
  6. xamd404

    xamd404 Peon

    Messages:
    20
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #6
    Lol yeh but its on a PHP page *rolls eyes*
     
    xamd404, Feb 27, 2011 IP