Jump to content

Row Values that are similar


TapeGun007

Recommended Posts

Just curious, but lets say a sales person in my company enters in a clients address of say "123 Main St".

 

But lets say that in my database there is already an entry that is "123 Main Street".

 

Is there a way either in php or mySQL to check if there is something that is a close match?

 

I'd like to be able to inform the sales person that this client was already entered into the database so they don't waste their time or create a duplicate entry.  Or is there a better way to accomplish this?

 

Thanks!

Link to comment
Share on other sites

Your mistake is in trying to determine a duplicate client based on an address. A client should have some unique identifier. An address can have several units or suites so it cannot be unique to a client. Additionally the same exact address can exist across city's or states.

 

In a normalized database you would have street names in it's own table with a unique index on the street name and then do an INSERT IGNORE to that table when adding new clients street names.

 

In your form you could use an AJAX auto-complete for the street name field that would pull any existing street names

 

If your database is setup correctly it would be impossible to insert duplicate anything.

Edited by benanamen
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.