Re: find (matching) person in other table
- From: farrishj@xxxxxxxxx ("Jared Farrish")
- Date: Wed, 30 May 2007 15:43:20 -0500
I was thinking to assign points (percentage) to matching fields (lastsimilar?
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
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." $$
- Follow-Ups:
- Re: [PHP] Re: find (matching) person in other table
- From: Afan Pasalic
- Re: find (matching) person in other table
- From: "Jared Farrish"
- Re: [PHP] Re: find (matching) person in other table
- Prev by Date: Re: [PHP] setting windows folder to chmod 644
- Next by Date: Re: [PHP] preg_match() returns false but no documentation why
- Previous by thread: Re: [PHP] find (matching) person in other table
- Next by thread: Re: find (matching) person in other table
- Index(es):
Relevant Pages
|