Re: find (matching) person in other table



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." $$


Relevant Pages

  • Re: self processing forms
    ... >> that I want to accomplish using php. ... What is your city of birth ... database so that the city of birth select box (the parent select box) will ... with a Javascript onchange placed on the parent box, ...
    (alt.php)
  • Can somebody help out with RegExps?
    ... I'm having extreme difficulties using RegExps for a specific problem ... How can I extract 3 lines before and after postal code + city? ... The line above the line holding postal code and city is assumed ...
    (comp.lang.php)
  • Re: [PHP] Re: find (matching) person in other table
    ... Jared Farrish wrote: ... name, first name, email, phone, city, zip, phone) and then list people ... have), since you posted this to a PHP mailing, you get a PHP answer! ... after last query I will have an array of people. ...
    (php.general)
  • Re: Validate City and NPA
    ... > I'm building a web site where people must register. ... I'm quite new in PHP, ... > come from ASP world. ... > I must absolutely be sure that the city they selected is correct. ...
    (alt.php)
  • Re: [PHP] Preventing SQL Injection/ Cross Site Scripting
    ... It's a shame that so many PHP installations have them enabled, and a huge disappointment that PHP is actually distributed with this stuff enabled! ... encoding data for output to an HTML document. ... characters into 5, 6, or 7-byte strings, if you already provided the correct character set in the Content-Type HTTP header. ... For anything that gets written to a database or used for a query, I suggest escaping the data using a function specifically designed for that database. ...
    (php.general)