Hello Afan & list,
I recently coded such an animal for a customer. It is a quick and dirty piece 
of work. They had an existing dataset and wanted to match new registrants 
against the dataset so as to avoid duplication. First we applied logic to not 
accept duplicate email addresses in the registration, and sent the potential 
duplicate user off to the password lookup page. Next we assigned a 
contact_type, usertype, and sales_status:

contact_type enum( "company", "individual") default "company";
usertype enum( "primary", "secondary", "other") default "primary";
sales_status enum( "open", "hide") default "open";

Explanation
Customer is using data for contact management and sales.
sales_status lets the admin toggle off visibility, so as to hide records they 
don't want to see
usertype lets multiple users exist from the same company - we can track 
everyone in their organization :), but only one is the primary contact

Match script
So next the match script was built which allows the admin to surf thru the 
dataset, and lookup any string. Of the data fields these were found to be 
significant for us:

username, email, companyname

So the Find Match script lets you click on any of username, email, companyname 
and pulls out LIKE "$username%" or LIKE "$email%" (but just the domain part) OR 
LIKE "$companyname%" examples, depending on what you selected. This yields a 
match in the last part, but not the first, of the selected match variable. I 
did not apply a percentage result such as you suggest. Matches can and are 
found in almost every data field. The trained human eye works better than a 
percentage, always will. Anyway, because the script result returns ONE LINE PER 
RECORD, and this line contains clickable links to match email, match username 
or match company (and edit record and other stuff), it lets the admin keep 
surfing thru the database finding matches, or not.

I arbitrarily limited matches to 20 rows, since the user can click on any line 
to initiate another match of a particular value, its not a biggy to keep 
searching, in fact, its fun and almost addictive ;)

Lastly I added on basic tools so the admin could change any of the values for 
any of the data fields. So the tool has a byproduct feature of letting the 
admin clean up their dataset while they're matching.

The sales person even had his wife doing match lookups for him within the week 
:)

This I'm sure is not the best or only way, but that's what we did, it works, 
and the customer is happy. Maybe it will help you too.

Sincerely,
rob
http://phpyellow.com

=======================================
Date: Wed, 30 May 2007 15:30:59 -0500
From: Afan Pasalic <[EMAIL PROTECTED]>
To: php-general <php-general@lists.php.net>
Subject: find (matching) person in other table
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?

thanks for any help.

-afan 

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to