Subject | Re: php case insensitive field access |
---|---|
Author | jackdmason |
Post date | 2013-01-25T20:56:35Z |
This solution will not work. Both InterBase and Firebird allow case insensitive searches, as does MySQL. The php interface should allow that option to be used as part of a query.
You cannot just capitalize the first and last name and accomplish anything. "McGrath" would not be found, nor would "van Duran", "MacDougal", etc., nor can you catch instances where a name has been entered incorrectly, such as Mcgee, variant spellings, etc.
At present we have to have our web server call a store server to process InterBase accesses because of this very reason; not only with names, but with book titles, authors (may or may not a name or company), etc.
We just need the php interface, at least for Firebird, to be fixed so we can do case insensitive searches. Delphi can do it, C++ can do it. Why cannot php do it?
You cannot just capitalize the first and last name and accomplish anything. "McGrath" would not be found, nor would "van Duran", "MacDougal", etc., nor can you catch instances where a name has been entered incorrectly, such as Mcgee, variant spellings, etc.
At present we have to have our web server call a store server to process InterBase accesses because of this very reason; not only with names, but with book titles, authors (may or may not a name or company), etc.
We just need the php interface, at least for Firebird, to be fixed so we can do case insensitive searches. Delphi can do it, C++ can do it. Why cannot php do it?
--- In firebird-php@yahoogroups.com, Lester Caine wrote:
>
> slobtrot wrote:
> > Here's an example:
> >
> > $sql = "SELECT * FROM CUST WHERE LASTNAME LIKE upper(?) AND FIRSTNAME LIKE upper(?)";
> > $sth = ibase_query( $db_handle, $sql, strtoupper($search_var1), strtoupper($search_var2));
> > if ($sth) {
> > if ($row = ibase_fetch_object($sth)) {
> > //$save_in_variable = $row->FIELDNAME;
> > }
> > }
> > ibase_free_result($sth);
> >
> > --- Infirebird-php@yahoogroups.com, "jackdmason" wrote:
> >> >
> >> >Using the php interface is there a way to specify in the query the data fields are to be case insensitive such that a query such as:
> >> >
> >> >SELECT * FROM CUST WHERE LASTNAME LIKE 'mcg%' AND FIRSTNAME LIKE 'jo%'
> >> >
> >> >will find Josh Mcgee, josh McGee, Joe McGrath, john mcGregor, etc.?
>
> It is not unusual to create triggers for the firstname and lastname fields to
> provide uc_fn and uc_ln which are then indexed also, so searching is a lot
> faster. Taking it a step further for genealogical data, this field can be a
> 'sound like' rather then a simple upper case. My own genealogical data actually
> uses both fields ;)
>
> --
> Lester Caine - G8HFL
> -----------------------------
> Contact - http://lsces.co.uk/wiki/?page=contact
> L.S.Caine Electronic Services - http://lsces.co.uk
> EnquirySolve - http://enquirysolve.com/
> Model Engineers Digital Workshop - http://medw.co.uk
> Rainbow Digital Media - http://rainbowdigitalmedia.co.uk
>