SitePoint Sponsor

User Tag List

Results 1 to 6 of 6
  1. #1
    SitePoint Zealot asrasrasr's Avatar
    Join Date
    Apr 2009
    Posts
    107
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Mysql search query

    hello friends,

    I m tring to search SMP-155-E-ST from mysql data base using following search query

    Code PHP:
    SELECT DISTINCT(prd_id), prd_title, prd_code, prd_pagetitle, prd_desc, prd_img1, prd_price, prd_saleprice, prd_rating, prd_color, prd_material, prd_finish, prd_style, prd_assembly, prd_height, prd_width, prd_depth, prd_weight FROM tbl_products WHERE prd_visible=1 AND MATCH(prd_code) AGAINST('SMP-155-E-ST' IN BOOLEAN MODE) ORDER BY prd_price ASC

    but this rutund nothing. but in my database there SMP-155-E-ST exist in pro_code

    where i m wrong.

  2. #2
    Non-Member
    Join Date
    Oct 2009
    Posts
    1,852
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Fulltext index intended to search textual data, not such math expressions
    did you try
    prd_code='SMP-155-E-ST'
    ?

  3. #3
    SitePoint Zealot asrasrasr's Avatar
    Join Date
    Apr 2009
    Posts
    107
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by Shrapnel_N5 View Post
    Fulltext index intended to search textual data, not such math expressions
    did you try
    prd_code='SMP-155-E-ST'
    ?
    no i cant use this prd_code='SMP-155-E-ST'. beacuse i m searching SKU CODE , Product Name, Brand Name in single query so this difficult to distingiush search keyword that what is that code prdicut name or brand name so i m using Fulltext index intended. r there is any other way to search

  4. #4
    Non-Member
    Join Date
    Oct 2009
    Posts
    1,852
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    you shouldn't use fulltext search on keywords, such as prducut name or brand name
    use standard comparsion instead.

  5. #5
    Non-Member
    Join Date
    Oct 2009
    Posts
    1,852
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Code:
    WHERE brand='SMP-155-E-ST' or product='SMP-155-E-ST' OR code='SMP-155-E-ST'
    is that you are looking for?

  6. #6
    SQL Consultant gold trophysilver trophybronze trophy
    r937's Avatar
    Join Date
    Jul 2002
    Location
    Toronto, Canada
    Posts
    39,021
    Mentioned
    53 Post(s)
    Tagged
    2 Thread(s)
    please don't write this --
    Code:
    SELECT DISTINCT(prd_id), prd_title, prd_code, prd_pagetitle, ...
    DISTINCT is not a function

    write this instead if necessary --
    Code:
    SELECT DISTINCT prd_id, prd_title, prd_code, prd_pagetitle, ...
    i say "if necessary" because in this query, DISTINCT is not necessary
    r937.com | rudy.ca | Buy my SitePoint book: Simply SQL
    "giving out my real stuffs"


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •