Teufel
|
| Posted: 01/27/2002, 4:58 AM |
|
Hi ALL!
Is it possible to create 'search forms' which would perform case insensitive searches? I am currently using %..% so that I match any part of the field, but it is not a case insensitive search.
Example: to find employees named 'John', I shall enter 'Jo', but not 'jo' (but that would not show records that were wrongly entered with 'john' all in lowercase).
Any tips?
TIA,
Teufel
|
|
|
 |
Alex Alexapolsky
|
| Posted: 01/28/2002, 2:47 AM |
|
You should convert all data to upper or lower case on the fly and then
compare.
|
|
|
 |
VD
|
| Posted: 01/29/2002, 4:05 AM |
|
Thanks Alex but could you give an example on how to achieve this, using PHP and mysql?
Thanks
|
|
|
 |
Brent
|
| Posted: 01/29/2002, 2:27 PM |
|
Teufel,
If you are using MySQL, then it already uses case insensitive searching
so you won't need to change anything. What database are you using?
If you are using a different database, then you will need to store the data
you're searching on in upper case (somewhat faster) perhaps in a duplicate column, or
uppercase the column in the SQL statement (slower). You will also need to
uppercase the search argument too. In either event, it won't be that fast. How
many records are you searching?
Brent
|
|
|
 |
Vince
|
| Posted: 01/30/2002, 8:20 AM |
|
For MySQL databases, I just found out that the case-sensitivity depends on the type of field that you have. For a blob field, it is case sensitive, for a text field, it is case INsensitive. I just changed the field type and it now works for me!
|
|
|
 |
Brent
|
| Posted: 01/30/2002, 8:58 PM |
|
:For MySQL databases, I just found out that the case-sensitivity depends on the type of field
:that you have. For a blob field, it is case sensitive, for a text field, it is case INsensitive. I just
:changed the field type and it now works for me!
Yes, that's correct. I didn't think to ask if you were using blob's because
they are used mainly for storing binary data. All MySQL text fields including
Text, Char, and VarChar are case insensitive which is a nice change from
other databases. :)
Their indexes are also bi-directional which means you don't need to create another
index to sort them in descending order; they can use the same index. Most
databases require another index to be built.
|
|
|
 |
bcschnei
|
| Posted: 05/21/2003, 5:04 PM |
|
Anyone have a way to do this in PHP and PostgreSQL?
An example of the code would be great.
Thanks,
Ben
|
|
|
 |
|