Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Matching Char in Form to dB

Status
Not open for further replies.

johk02

Programmer
Aug 20, 2003
169
AU
What I want to achieve is when someone enters the name of their suburb (say Abbotsford) but they spell it wrong (say Abotsford) how do I match the characters entered to the ones in the dB??
This is for a registration form and they are also entering the Postcode which means the numbers of matches are limited to at the most 5 to 6 suburbs.

Thanks
Jonas
 
I was thinking along the lines of using a regex to match or see if the characters that are entered in to the form fields match the ones in the query.
My idea was to first retrieve the suburbs/localities that match a particular postcode and then match the characters that are entered to one of the retrieved suburbs.
The reason of doing it this way is that I can't rely on that the suburb entered is spelt correctly.

Thanks

Jonas

 
you can also try

<cfquery .... >
SELECT stuff
FROM myTable
WHERE suburb LIKE '%mySuburb%'
</cfquery>

one thing to note though, to get Abbotsford when somebody types Abotsford, you may want to modify the query as
LIKE 'Ab%'

hope it helps...


 
Try using a combination of SOUNDEX and DIFFERENCE (MS SQL assumed here). I use this function to match records in my DB with postal service data:

difference(rtrim(ltrim(zp_Streetname)),rtrim(ltrim(ret_streetname))) >=3

Phil Hegedusich
Senior Programmer/Analyst
IIMAK
-----------
I'll have the roast duck with the mango salsa.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top