RE: [PHP-WIN] Pasring a street address field for an SQL search
| From: | Zak Greant | Date: | Tue, 22 Aug 2000 19:31:45 +0000 |
| Subject: | RE: [PHP-WIN] Pasring a street address field for an SQL search | ||
| References: | 1 | Groups: | php.windows |
| Request: | Send a blank email to php-windows+get-2048@lists.php.net to get a copy of this message | ||
At 03:05 PM 8/22/00 -0400, Asendorf, John wrote:
I can write the SQL... it's parsing the form TO write the SQL that I'm having problems with... Is there a way to parse the data using spaces as a delimiter?Ah - now I understand :) Try this: $address = '444 West Main Street'; $match = eregi_replace ('([a-z])[^[:space:]]+([[:space:]]+|$)', '\\1% ', $address); Read the PHP regular expression docs to get a better handle on how this works - also check out the O'Reilly book on regular expressions. - zak
kind of like this: parse($fulladdress, " ") if ( $fulladdress_piece2 = "W" or "E" or "S" or "N" ) {$full_address_piece2_temp %= $fulladdress_piece2 }; if $fulladdress_piece2 = "west" {$full_address_piece2_temp = "w%" }etc. etc. etc. THEN select * from table where address like '$fulladdress_sql_pieced_together' --------------------- John Asendorf - jasendorf@lcounty.com Web Applications Developer - http://www.lcounty.com Licking County, Ohio, USA 740-349-3631 -----Original Message----- From: Zak Greant [mailto:zak@php.net] Sent: Tuesday, August 22, 2000 2:15 PM To: Asendorf, John Cc: php-windows@lists.php.net Subject: Re: [PHP-WIN] Pasring a street address field for an SQL search At 01:56 PM 8/22/00 -0400, you wrote:Hello All! NT PHP4 IIS4 M$Access (ODBC) Trying to figure out how to parse a street address field sothat I can hita database with some options... The form field allowssomeone to put in astreet address... For instance: 444 West Main Street The problem I'm running into is that the database *may* havethe addresslisted as 444 W Main St OR 444 West Main St. OR 444 W. Main StreetIn SQL I can do this select * from table where address like '444 W% M% S%' I am not sure what the equivalent syntax is in Access hth, zak -- PHP Windows Mailing List (http://www.php.net/) To unsubscribe, e-mail: php-windows-unsubscribe@lists.php.net For additional commands, e-mail: php-windows-help@lists.php.net To contact the list administrators, e-mail: php-list-admin@lists.php.net