Characters causing problems in search strings?
am 16.07.2009 23:40:39 von tmiller
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
Re: Characters causing problems in search strings?
am 17.07.2009 15:11:52 von Phpster
On Thu, Jul 16, 2009 at 5:40 PM, Miller,
Terion 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
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php