PDA

View Full Version : fuzzy matches


cedsn
08-13-2002, 06:37 AM
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

Spudhead
08-16-2002, 05:48 PM
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?