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 2 of 2

Thread: fuzzy matches

  1. #1
    New Coder
    Join Date
    Aug 2002
    Location
    san marcos TX
    Posts
    23
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Question fuzzy matches

    how do i get fuzzy or pattern matches from mysql?

    for example, i have an entry,

    APP 11-32

    now, i have set up a search script that querys the db with

    select * from table where partnumber = "$query";

    and this works fine as long as i type it in exactly..

    however i want ppl to be able to type in get matches with queries such as

    app11/32
    app-11-32
    11-32
    1132

    .. etc, and still get matches. any ideas?
    i am using perl to write the scripts.

    thanks, jesse

  • #2
    Senior Coder Spudhead's Avatar
    Join Date
    Jun 2002
    Location
    London, UK
    Posts
    1,856
    Thanks
    8
    Thanked 110 Times in 109 Posts

    like

    Use LIKE?

    and use % as wildcard:

    select * from table where partnumber LIKE "%$query%";

    might not find everything, and my syntax might be out (not a Perl coder) but it should help.

    Any use?


  •  

    Posting Permissions

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