RE: [PHP-DB] Query question about how to do a select which return s things that resemble the input

From: Date: Wed, 21 Jun 2000 13:37:58 +0000
Subject: RE: [PHP-DB] Query question about how to do a select which return s things that resemble the input
References: 1  Groups: php.db php.general 
Request: Send a blank email to php-general+get-2485@lists.php.net to get a copy of this message
> I would suggest you break down Terdam into segments of varying > length. I got a bit carried away so i attched a function and > an example. > It should result in something like; > SELECT > * > FROM > mytable > WHERE > afield = 'foo' and > anotherfield = 'bar' and > > LOWER(myfield) like '%terdam%' OR > LOWER(myfield) like '%terda%' OR > LOWER(myfield) like '%erdam%' OR > LOWER(myfield) like '%terd%' OR > LOWER(myfield) like '%erda%' OR > LOWER(myfield) like '%rdam%' OR > LOWER(myfield) like '%rda%' OR > LOWER(myfield) like '%erd%' OR > LOWER(myfield) like '%dam%' OR > LOWER(myfield) like '%ter%' > ) > > [snip] This is starting to look like the sort of thing which might get a whole lot simpler if it took advantage of soundex (assuming a database that supports it). Hmmm...except that might present some different challenges with regard to substrings. Oh well...potentially worth reading up on, anyway... http://www.dcs.ed.ac.uk/home/stg/pub/S/soundex.html http://www.mysql.com/php/manual.php3?section=String_functions http://www.php.net/manual/function.soundex.php --- Mark Roedel (roedelm@letu.edu) || We have only two things to worry about: Systems Programmer / WebMaster || That things might never get back to LeTourneau University || normal, and that they already have.

« previous php.general (#2485) next »