php - mysql OR clause respective to AND clause -


i have form filtering/sorting database records.

i'm filtering posts author, category, , tags. i'm using and clause author , category , or clause tags (multiple tags can entered)

a query looks this

select * (`posts`) `author` = 'dan'   , `category` = 'technology'   , `tags` '%ebook%'   or `tags` '%ipad%'   or `tags` '%apple%' 

the query above returns posts contain tag searched regardless of author or category.

i want return posts containing tags ebook, ipad, apple within author name dan , category technology.

how possible in mysql?

add brackets around or's

select      *       (`posts`)       `author` = 'dan' ,      `category` = 'technology' ,       ( `tags` '%ebook%' or `tags` '%ipad%' or `tags` '%apple%' ) 

Comments

Popular posts from this blog

c# - SharpSVN - How to get the previous revision? -

c++ - Is it possible to compile a VST on linux? -

url - Querystring manipulation of email Address in PHP -