Welcome to dbFreaks.com!
FAQFAQ    SearchSearch      ProfileProfile    Private MessagesPrivate Messages   Log inLog in

Capitalization in PHP

 
   Database Help (Home) -> PHP SQL RSS
Next:  problems with sprintf and escaping %  
Author Message
Matthew White

External


Since: Jul 16, 2007
Posts: 5



(Msg. 1) Posted: Wed Apr 16, 2008 12:34 am
Post subject: Capitalization in PHP
Archived from groups: alt>php>sql (more info?)

Hello all,

I'm trying to build a site that searches through a MySQL database of songs.
I need to be able to take user input, and narrow the song list down.
However, if a user types in "C", but the song starts with "c", they will not
the song. Is there anyway to make MySQL ignore capitalization in a request?
I would like to find a way around having to de-capitalize all the songs in
the database, which is my only option right now. Any help would be
appreciated.

Matt White

 >> Stay informed about: Capitalization in PHP 
Back to top
Login to vote
Preventer of Work

External


Since: Oct 19, 2007
Posts: 15



(Msg. 2) Posted: Wed Apr 16, 2008 2:31 am
Post subject: Re: Capitalization in PHP [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

Matthew White wrote:
> Hello all,
>
> I'm trying to build a site that searches through a MySQL database of
> songs. I need to be able to take user input, and narrow the song list
> down. However, if a user types in "C", but the song starts with "c",
> they will not the song. Is there anyway to make MySQL ignore
> capitalization in a request? I would like to find a way around having to
> de-capitalize all the songs in the database, which is my only option
> right now. Any help would be appreciated.
>
> Matt White

Mysql searches are no case sensitive. Looking for joE find Joe, joe and JOE.

See the old docs at
http://dev.mysql.com/doc/refman/4.1/en/case-sensitivity.html
or 5.1 docs:
http://dev.mysql.com/doc/refman/5.1/en/case-sensitivity.html

 >> Stay informed about: Capitalization in PHP 
Back to top
Login to vote
Matthew White

External


Since: Jul 16, 2007
Posts: 5



(Msg. 3) Posted: Wed Apr 16, 2008 7:10 pm
Post subject: Re: Capitalization in PHP [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

I am using a binary coalition that means that my queries are case sensitive.
Any way of getting around that?


"Preventer of Work" wrote in message

> Matthew White wrote:
>> Hello all,
>>
>> I'm trying to build a site that searches through a MySQL database of
>> songs. I need to be able to take user input, and narrow the song list
>> down. However, if a user types in "C", but the song starts with "c", they
>> will not the song. Is there anyway to make MySQL ignore capitalization
>> in a request? I would like to find a way around having to de-capitalize
>> all the songs in the database, which is my only option right now. Any
>> help would be appreciated.
>>
>> Matt White
>
> Mysql searches are no case sensitive. Looking for joE find Joe, joe and
> JOE.
>
> See the old docs at
> http://dev.mysql.com/doc/refman/4.1/en/case-sensitivity.html
> or 5.1 docs:
> http://dev.mysql.com/doc/refman/5.1/en/case-sensitivity.html
>
 >> Stay informed about: Capitalization in PHP 
Back to top
Login to vote
Preventer of Work

External


Since: Oct 19, 2007
Posts: 15



(Msg. 4) Posted: Thu Apr 17, 2008 12:01 am
Post subject: Re: Capitalization in PHP [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

Matthew White wrote:
> I am using a binary coalition that means that my queries are case
> sensitive. Any way of getting around that?
>
>
> "Preventer of Work" wrote in message
>
>> Matthew White wrote:
>>> Hello all,
>>>
>>> I'm trying to build a site that searches through a MySQL database of
>>> songs. I need to be able to take user input, and narrow the song list
>>> down. However, if a user types in "C", but the song starts with "c",
>>> they will not the song. Is there anyway to make MySQL ignore
>>> capitalization in a request? I would like to find a way around having
>>> to de-capitalize all the songs in the database, which is my only
>>> option right now. Any help would be appreciated.
>>>
>>> Matt White
>>
>> Mysql searches are no case sensitive. Looking for joE find Joe, joe
>> and JOE.
>>
>> See the old docs at
>> http://dev.mysql.com/doc/refman/4.1/en/case-sensitivity.html
>> or 5.1 docs:
>> http://dev.mysql.com/doc/refman/5.1/en/case-sensitivity.html
>>

You can generate a string to drive a regular expression. It's a bit of
work, but not too much. Here's the idea:

mysql> select * from incase where name = 'joe';
+----+------+
| id | name |
+----+------+
| 1 | joe |
+----+------+


mysql> select * from incase where name REGEXP '[Jj]oe';
+----+------+
| id | name |
+----+------+
| 1 | joe |
| 2 | Joe |
+----+------+

You would take the search string and just generate char pairs in
brackets, so

'Joe' becomes '[Jj][Oo][Ee]'

However, this is easier:

mysql> select * from incase where LOWER(name) = 'joe';
+----+------+
| id | name |
+----+------+
| 1 | joe |
| 2 | Joe |
+----+------+
 >> Stay informed about: Capitalization in PHP 
Back to top
Login to vote
Preventer of Work

External


Since: Oct 19, 2007
Posts: 15



(Msg. 5) Posted: Thu Apr 17, 2008 12:02 am
Post subject: Re: Capitalization in PHP [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

Preventer of Work wrote:
> Matthew White wrote:
>> I am using a binary coalition that means that my queries are case
>> sensitive. Any way of getting around that?
>>
>>
>> "Preventer of Work" wrote in message
>>
>>> Matthew White wrote:
>>>> Hello all,
>>>>
>>>> I'm trying to build a site that searches through a MySQL database of
>>>> songs. I need to be able to take user input, and narrow the song
>>>> list down. However, if a user types in "C", but the song starts with
>>>> "c", they will not the song. Is there anyway to make MySQL ignore
>>>> capitalization in a request? I would like to find a way around
>>>> having to de-capitalize all the songs in the database, which is my
>>>> only option right now. Any help would be appreciated.
>>>>
>>>> Matt White
>>>
>>> Mysql searches are no case sensitive. Looking for joE find Joe, joe
>>> and JOE.
>>>
>>> See the old docs at
>>> http://dev.mysql.com/doc/refman/4.1/en/case-sensitivity.html
>>> or 5.1 docs:
>>> http://dev.mysql.com/doc/refman/5.1/en/case-sensitivity.html
>>>
>
> You can generate a string to drive a regular expression. It's a bit of
> work, but not too much. Here's the idea:
>
> mysql> select * from incase where name = 'joe';
> +----+------+
> | id | name |
> +----+------+
> | 1 | joe |
> +----+------+
>
>
> mysql> select * from incase where name REGEXP '[Jj]oe';
> +----+------+
> | id | name |
> +----+------+
> | 1 | joe |
> | 2 | Joe |
> +----+------+
>
> You would take the search string and just generate char pairs in
> brackets, so
>
> 'Joe' becomes '[Jj][Oo][Ee]'
>
> However, this is easier:
>
> mysql> select * from incase where LOWER(name) = 'joe';
> +----+------+
> | id | name |
> +----+------+
> | 1 | joe |
> | 2 | Joe |
> +----+------+
>
>
Ooops, LOWER() both arguments
 >> Stay informed about: Capitalization in PHP 
Back to top
Login to vote
Matthew White

External


Since: Jul 16, 2007
Posts: 5



(Msg. 6) Posted: Sat Apr 19, 2008 12:07 am
Post subject: Re: Capitalization in PHP [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

OK, that works. Thanks for the help!

"Preventer of Work" wrote in message

> Preventer of Work wrote:
>> Matthew White wrote:
>>> I am using a binary coalition that means that my queries are case
>>> sensitive. Any way of getting around that?
>>>
>>>
>>> "Preventer of Work" wrote in message
>>>
>>>> Matthew White wrote:
>>>>> Hello all,
>>>>>
>>>>> I'm trying to build a site that searches through a MySQL database of
>>>>> songs. I need to be able to take user input, and narrow the song list
>>>>> down. However, if a user types in "C", but the song starts with "c",
>>>>> they will not the song. Is there anyway to make MySQL ignore
>>>>> capitalization in a request? I would like to find a way around having
>>>>> to de-capitalize all the songs in the database, which is my only
>>>>> option right now. Any help would be appreciated.
>>>>>
>>>>> Matt White
>>>>
>>>> Mysql searches are no case sensitive. Looking for joE find Joe, joe and
>>>> JOE.
>>>>
>>>> See the old docs at
>>>> http://dev.mysql.com/doc/refman/4.1/en/case-sensitivity.html
>>>> or 5.1 docs:
>>>> http://dev.mysql.com/doc/refman/5.1/en/case-sensitivity.html
>>>>
>>
>> You can generate a string to drive a regular expression. It's a bit of
>> work, but not too much. Here's the idea:
>>
>> mysql> select * from incase where name = 'joe';
>> +----+------+
>> | id | name |
>> +----+------+
>> | 1 | joe |
>> +----+------+
>>
>>
>> mysql> select * from incase where name REGEXP '[Jj]oe';
>> +----+------+
>> | id | name |
>> +----+------+
>> | 1 | joe |
>> | 2 | Joe |
>> +----+------+
>>
>> You would take the search string and just generate char pairs in
>> brackets, so
>>
>> 'Joe' becomes '[Jj][Oo][Ee]'
>>
>> However, this is easier:
>>
>> mysql> select * from incase where LOWER(name) = 'joe';
>> +----+------+
>> | id | name |
>> +----+------+
>> | 1 | joe |
>> | 2 | Joe |
>> +----+------+
>>
>>
> Ooops, LOWER() both arguments
 >> Stay informed about: Capitalization in PHP 
Back to top
Login to vote
Tom

External


Since: Oct 15, 2007
Posts: 42



(Msg. 7) Posted: Mon Apr 21, 2008 10:58 am
Post subject: Re: Capitalization in PHP [Login to view extended thread Info.]
Imported from groups: per prev. post (more info?)

Back to top
Login to vote
Display posts from previous:   
Related Topics:
PHPtriad v2.2.1 removal - When I fist started using apache/php/mysql I used phptriad [a wonderful piece of kit] to get me up and running. I've used this ever since. I'm think inow of 'upgrading' to laters versions of all three applications, and have found various tutorials/Ho...

MySQL regular expression to match a imploded item - Hello I need to use MySQL's REGEXP (POSIX compliant) to search registries where one field is an imploded set of integer values separated with pipes "|". I need to match one of these imploded values directly on a sql select. $sql = "SELECT...

Weird mysql_connect problem - Hello. My mysql_connect just started to give me following error today, Fatal error: Call to undefined function: mysql_connect() in ..../database_functions/db_functions.inc.php on line 11. So it seems that my php no longer finds php-mysql module...

MySQL - question about displaying data - I am working an some pages that have database content on them. I'm sorry that I don't have any versions of it online yet, but it isn't hard to explain. The site lists restaurants with contact information. All of the information is kept in a MySQL..

How can i Optimize sql Query ? - Hi, I'd like to optimize this query: Code: SELECT * FROM `links` WHERE active = "1" AND mainweight != 0 ORDER BY Rand()*(1/mainweight) LIMIT 5 I have a database of links wich has 3 000 rows. I'd like to select weighted random links from ...
   Database Help (Home) -> PHP SQL All times are: Pacific Time (US & Canada)
Page 1 of 1

 
You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum



[ Contact us | Terms of Service/Privacy Policy ]