Select where

Discussion in 'PHP' started by baris22, Aug 31, 2009.

  1. #1
    Hello,

    How can i use select where function for 2 things?
    
    
    SELECT id, title FROM web WHERE category=10
    
    
    PHP:
    this works but i want to add category=11 aswell. when i do

    
    
    SELECT id, title FROM web WHERE category=10 AND category=11
    SELECT id, title FROM web WHERE category=('10', '11')
    
    
    PHP:
    it does not work.
     
    baris22, Aug 31, 2009 IP
  2. premiumscripts

    premiumscripts Peon

    Messages:
    1,062
    Likes Received:
    48
    Best Answers:
    0
    Trophy Points:
    0
    #2
    You need an OR, not an AND. Or use the IN (..) syntax.

    
    SELECT id, title FROM web WHERE category = 10 OR category = 11
    SELECT id, title FROM web WHERE category IN (10,11)
    
    Code (markup):
     
    premiumscripts, Aug 31, 2009 IP