I was thinking to assign points (percentage) to matching fields (last
name, first name, email, phone, city, zip, phone) and then list people
with more than 50%. e.g., if first and last name match - 75%, if only
email match - 85%, if first name, last name and email match - 100%, if
last name and phone match - 50%... etc.

does anybody have any experience with such a problem? or something
similar?

Although you should be able to do this with you SELECT (I guess, never
have), since you posted this to a PHP mailing, you get a PHP answer!

Look up Levinshtein in the php manual and start from there:

http://us2.php.net/manual/en/function.levenshtein.php

If you can do this on SELECT (using the db engine), I would suggest that, as
that way you don't have to return a giant list to poke through.

You can also use wildcards, and only select matches that have the first
three characters:

$lastname = strpos('Rogers',0,2);
$firstname = strpos('Timothy',0,2);
$select = "SELECT `uid`,`LastName`,`FirstName`
               FROM `users`
               WHERE LastName='$lastname%'
               AND FirstName='$firstname%'";

I haven't tested that, but I think it would work. You would need to work on
a way to LIMIT the matches effectively. If that doesn't work, hey, this is a
PHP list...

--
Jared Farrish
Intermediate Web Developer
Denton, Tx

Abraham Maslow: "If the only tool you have is a hammer, you tend to see
every problem as a nail." $$

Reply via email to