473,800 Members | 2,623 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Matching Items in Mysql Result

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_co unt.'</td>
<td>'.$names_la st_name.'</td>
<td>'.$names_fi rst_name.'</td>
<td>'.$names_mi ddle_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
1 1074
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_co unt.'</td>
<td>'.$names_la st_name.'</td>
<td>'.$names_fi rst_name.'</td>
<td>'.$names_mi ddle_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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
1667
by: Adam | last post by:
Hello all, I have written a script that utilizes mysql_unbuffered_query to quickly perform a series of if statements on the returned row as my result sets are roughly 50,000,000+ in size. With the script I am interating through each field of the returned row and performing a check to see if the field contains what I am searching for. If it does, it writes the row id to a file and continues with the next row.
9
3218
by: Xah Lee | last post by:
# -*- coding: utf-8 -*- # Python # Matching string patterns # # Sometimes you want to know if a string is of # particular pattern. Let's say in your website # you have converted all images files from gif # format to png format. Now you need to change the # html code to use the .png files. So, essentially
2
2430
by: rowan[canspam] | last post by:
I have two tables ITEMS: items,description,mfg MANUFACTURER: mfg,full_name The items database has 230,000 records, the manufacturer, 493 records. I want to see how many records in the items table don't have a matching record in the
2
1766
by: brice | last post by:
Hello, I am using using the following code to transform a memo xml file. I am using Internet Explorer 6.0 to transform and view the file as HTML. <!-- ***** BEGIN XML ***** --> <?xml version="1.0"?> <?xml-stylesheet type="text/xsl" href="test.xsl"?> <MEMO ID="1"> <AUTHOR ID="1">
6
1839
mmarif4u
by: mmarif4u | last post by:
Hi everyone. i make a page that a user input thier icnumber with confirm ic number, it saves the data to mysql db with current date and a random access code generated automatically, NOW i have some problems facing.. 1: How to match both txt box vlaues that r same or not.Is there php code for it. 2: I want to put a print button in the code where the code display the page after entring the icnumber and after submit. 3: How to show the...
1
2302
by: Ted | last post by:
Here is a stored procedure I created in MySQL: CREATE PROCEDURE `sp_find_food`( IN search_string varchar(255) ) BEGIN DECLARE ss VARCHAR(257); SET ss = CONCAT('%',search_string,'%'); SELECT NDB_No,Long_Desc FROM food_des WHERE Long_Desc LIKE ss; END
221
367762
Atli
by: Atli | last post by:
You may be wondering why you would want to put your files “into” the database, rather than just onto the file-system. Well, most of the time, you wouldn’t. In situations where your PHP application needs to store entire files, the preferred method is to save the file onto the server’s file-system, and store the physical location of the file in your database. This is generally considered to be the easiest and fastest way to store files. ...
13
1602
by: lenygold via DBMonster.com | last post by:
I found this problem on ORACLE board. 2 input TABLES: Items Id ItemName 1 Phone 2 Table 3 Lamp 4 TV 5 Stereo
8
2135
by: mfaisalwarraich | last post by:
hello, im trying to make an attendance record. im using a form where im entering two values, 1. Date 2. Absent Students im entering roll numbers of the absent students separated by "-" like this: 5-10-15-20-21-23. these roll numbers are then stored into a mysql database in the same format. now there are all 50 students which are stored in a different table. i just want to match these roll numbers who are absent against all 50...
0
9691
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9551
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10279
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10255
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10036
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
6815
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5473
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5607
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3765
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.