Results 1 to 2 of 2

Thread: Search Issues

  1. #1
    Join Date
    Oct 2008
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Search Issues

    I am pretty new to MySQL, so I don't know if I'm explaining this right. Please excuse me! :-)

    I have an image bank with a search feature. The sql document code looks like this:

    INSERT INTO novoCatalog VALUES (0,'M3877','',1,'imgCatalog/abstractModern3/M3877.jpg',' watercolor yellow orange red','small',62,3877,0);

    (The red text is of course the search terms that define when the specific image will show up.)

    My problem is that when you type say "water" in the search bar, the results return all these unrelated images because "watercolor" has the word "water" in it. How do I keep that from happening? Is there exceptions I can input into the code or something?

  2. #2
    Join Date
    Jan 2007
    Location
    Davenport, Iowa
    Posts
    2,385
    Thanks
    100
    Thanked 113 Times in 111 Posts

    Default

    Code:
    select * from novoCatalog where column REGEXP 'water([[:blank:]]|$)'
    That should do the trick. the above will match water followed by a space or water that is at the end of a string.

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
  •