TapeGun007 Posted November 19, 2015 Share Posted November 19, 2015 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! Quote Link to comment https://forums.phpfreaks.com/topic/299524-row-values-that-are-similar/ Share on other sites More sharing options...
maxxd Posted November 19, 2015 Share Posted November 19, 2015 This could possibly work for you. Quote Link to comment https://forums.phpfreaks.com/topic/299524-row-values-that-are-similar/#findComment-1526743 Share on other sites More sharing options...
benanamen Posted November 19, 2015 Share Posted November 19, 2015 (edited) 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 November 19, 2015 by benanamen Quote Link to comment https://forums.phpfreaks.com/topic/299524-row-values-that-are-similar/#findComment-1526746 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.