mysql search

Discussion in 'MySQL' started by kool002, May 6, 2007.

  1. #1
    hi,
    Is this correct query for searching articles table where body has 'acne scar' string and catid not equal to 5

    select * from articles
    WHERE MATCH (content)
    AGAINST ('acne scar')
    and catid != 5
     
    kool002, May 6, 2007 IP
  2. ideas_man

    ideas_man Active Member

    Messages:
    212
    Likes Received:
    12
    Best Answers:
    0
    Trophy Points:
    58
    #2
    I "think" that is right.It has been a while since I've done fulltext searching.

    Of course the quickest way to find out would be to try it :)

    There are also some examples in the MySQL manual that extend it further.

    Mysql Fulltext Searching

    Hope that helps :)
     
    ideas_man, May 6, 2007 IP
  3. Golfboards

    Golfboards Peon

    Messages:
    122
    Likes Received:
    1
    Best Answers:
    0
    Trophy Points:
    0
    #3
    That should work. You could also do something like this:

    SELECT * from articles WHERE catid != '5' AND content LIKE 'acne scar'
     
    Golfboards, May 7, 2007 IP
  4. olddocks

    olddocks Notable Member

    Messages:
    3,275
    Likes Received:
    165
    Best Answers:
    0
    Trophy Points:
    215
    #4
    Yes its fine. The logic goes like this.

    -> Find no of results matching <cond>
    -> Display results
    -> Use Paging.
    -> You can also use like %query%

    When comes to search mysql is not very efficient in search results. You will need to use the free scripts listed here
     
    olddocks, May 7, 2007 IP
  5. kool002

    kool002 Peon

    Messages:
    342
    Likes Received:
    5
    Best Answers:
    0
    Trophy Points:
    0
    #5
    Thank you all
     
    kool002, May 9, 2007 IP