Results 1 to 2 of 2

Thread: Search MySQL Database

  1. #1

    Thread Starter
    WiggleWiggle dclamp's Avatar
    Join Date
    Aug 2006
    Posts
    3,527

    Search MySQL Database

    i want to query the database for say "dog" but if i just type that in, it will only show results that are exactly "dog" not "dogs" "doggies" etc...

    How do i do this?
    My usual boring signature: Something

  2. #2
    PowerPoster
    Join Date
    Sep 2003
    Location
    Edmonton, AB, Canada
    Posts
    2,629

    Re: Search MySQL Database

    use the like operator with a wildcard. the like operator will allow case insensitive matches and the wild card will allow partial matches of your term. the wild card for mysql is "%."

    Code:
    SELECT field1, field2 FROM tablename WHERE field3 LIKE '%dog%';
    the above will match DOG, dOg, dogs, DOGGIES, etc.

Posting Permissions

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



Click Here to Expand Forum to Full Width