Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    Regular Coder
    Join Date
    Aug 2004
    Location
    Nashville
    Posts
    202
    Thanks
    0
    Thanked 0 Times in 0 Posts

    PHP / MySQL Search Problem

    Greetings,


    I've got a simple search form whereas users can search products on my site. On the dbase end I've got a column called product_keywords and it has terms separated with a comma:

    ie: brown, necklace, handbag, trendy...

    and when I search for brown necklace I get no results but if I search for necklace brown I get acceptable results.

    Here's my query

    PHP Code:
    $sql="SELECT * FROM products WHERE product_showonfrontend='Y' AND (INSTR(LCASE(product_source_code),'".$search_text."') != 0 OR INSTR(LCASE(product_name),'".$search_text."') != 0  OR INSTR(LCASE(product_general_category),'".$search_text."') != 0 OR INSTR(LCASE(product_description),'".$search_text."') != 0 OR INSTR(LCASE(product_keywords),'".$search_text."') )"
    any ideas?
    Last edited by macmonkey; 01-11-2006 at 03:09 AM.

  • #2
    Regular Coder devinemke's Avatar
    Join Date
    Dec 2004
    Location
    NYC
    Posts
    443
    Thanks
    0
    Thanked 12 Times in 11 Posts
    you should really look at Full-Text Searching

  • #3
    Regular Coder
    Join Date
    Aug 2004
    Location
    Nashville
    Posts
    202
    Thanks
    0
    Thanked 0 Times in 0 Posts

    yea

    I know about FULLTEXT and wish that I could just use that BUT... the table type isn't MYISAM so that wont work for me.

    If it was a personal site I'd change it but it's for a client


  •  

    Posting Permissions

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