Re: find (matching) person in other table

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Richard Lynch wrote:
On Wed, May 30, 2007 3:30 pm, Afan Pasalic wrote:
hi,
the code I'm working on has to compare entered info from registration
form with data in members table and list to administrator (my client)
all "matching" people. admin then has to decide is person who
registered
already in database and assign his/her member_id or the registered
person is new one and assign new member_id.

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?

I've played this game several times.

You generally have to have a human override, because it will never be
perfect, no mater how much you tweak it -- I mean, let the admin also
just "search" for whatever they want to match up the new registration
with the old person.
yes. that's the plan. to show all "matching" people and admin will then decide who is REALLY the match (if any).

You may have only the first name matching on somebody who got married
and moved that won't score well...
right. I forgot about this possibility :-(


But you'll have 10 John Smith's in there.

You can do it fairly easily building the query dynamically:

<?php
  //find possible duplicates/existing members:
  $query = "select member_id, name, address, phone, etc ";
  //all members get 0 points to start:
  $query .= " 0 ";
  //add 5 points for last name matching:
  $query .= " + 5 * (last_name = '$last_name') ";
  //add 1 point for first name matching:
  $query .= " + (first_name = '$first_name') ";
  //and so on
  $query .= " as score ";
  $query .= " from member ";
  //maybe this has to be: HAVING score > 0
  $query .= " where score > 0 ";
?>

You can play all kinds of games with the numbers and weighting various
bits of data -- but complicating it too much beyond the obvious
natural choice rarely improves the success rate very much...

A simple checkbox on the form:
Are you already a member: ____
will help provide an invaluable cross-check as to whether there SHOULD
be a member record....
good point too!
;-)

thanks.

-afan

[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux