By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
432,009 Members | 1,487 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 432,009 IT Pros & Developers. It's quick & easy.

Matching Items in Mysql Result

P: n/a
I am pulling a list of names from a mysql table and then display the
results with this:

while ($names_row = $names_result->fetch_assoc())
{
echo '
<tr>
<td>'.$names_count.'</td>
<td>'.$names_last_name.'</td>
<td>'.$names_first_name.'</td>
<td>'.$names_middle_initial.'</td>
</tr>
}

Simple. The database query groups the names so that they are only
displayed once. The purpose of this is to display names entered for a
nomination process. The problem is that sometimes names are entered
differently. One person may enter Mike, and another enters Michael but
the last name is the same. I know then that this is actually the same
person. The results show up on different lines though, so I need to
flag these results in some way. I want to be able to show on the page
in bold where last name matches.

Can someone give me some direction on how I could go about this? Do I
need to use an array?
Dec 7 '07 #1
Share this Question
Share on Google+
1 Reply


P: n/a
On Fri, 07 Dec 2007 15:53:26 +0100, mtuller <mi******@gmail.comwrote:
I am pulling a list of names from a mysql table and then display the
results with this:

while ($names_row = $names_result->fetch_assoc())
{
echo '
<tr>
<td>'.$names_count.'</td>
<td>'.$names_last_name.'</td>
<td>'.$names_first_name.'</td>
<td>'.$names_middle_initial.'</td>
</tr>
}

Simple. The database query groups the names so that they are only
displayed once. The purpose of this is to display names entered for a
nomination process. The problem is that sometimes names are entered
differently. One person may enter Mike, and another enters Michael but
the last name is the same. I know then that this is actually the same
person. The results show up on different lines though, so I need to
flag these results in some way. I want to be able to show on the page
in bold where last name matches.

Can someone give me some direction on how I could go about this? Do I
need to use an array?
You should have a table with 'unique' persons, and and possibly a separate
table nominations/votes which is related to that by primary key. On a
vote/nomination, let the users choose from a list from 'people allready
available', or enter a new one. This will hopefully keep duplicates to a
minimum, and even if someone is entered under a slightly other name, it's
just a question of updating the related 'persons'-id of the votes in some
admin process (either with an interface or just a raw database query), and
removing the 'duplicate' row. Offcourse, you'll trim/standardize
capitalisation etc. to keep it duplicates to a minimum, maybe could also
use the LIKE and/or SOUNDEX functionality of the database to suggest a
person allready in the table if someone enters a slightly different one
(still giving the users the possibility to confirm this is really another
person,"Are you really sure you don't mean on of these?").

There is no way this process can be automated without losing the ability
to nominate 'new' persons: Who is to say Mike Johnson and Michael Johnson
aren't different persons? They might be very well be, they're just not in
this case.
--
Rik Wasmus
Dec 7 '07 #2

This discussion thread is closed

Replies have been disabled for this discussion.