Re: Characters causing problems in search strings?

From: Date: Fri, 17 Jul 2009 13:11:52 +0000
Subject: Re: Characters causing problems in search strings?
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-295518@lists.php.net to get a copy of this message
On Thu, Jul 16, 2009 at 5:40 PM, Miller, Terion<tmiller@springfi.gannett.com> wrote: > My little browse /search restaurant project is coming along, but I just > noticed that any restaurant with a &, () or # in the name like say for > example Arby's Store #12 ...will not return results... Yet if a name has a / > or a - it's not a problem... > 1. why is this and how do and where do I escape those characters on the > query? Or on the insert? > > Thanks in Advance > > > -- > PHP General Mailing List (http://www.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php > > There are really two approaches: 1. filter the data (remove the characters you decide you don't want in there and are irrelevant) 2. encode them to store them Personally I lean towards removing the unwanted characters. The main reason is that you then can do a better job of controlling the data when a query is made, spaces or other characters that are in the name can result in queries that don't return any data because there is no exact match -- Bastien Cat, the other other white meat

« previous php.general (#295518) next »