Interesting Update Query

Do you have a question? Post it now! No Registration Necessary.  Now with pictures!

Threaded View

 Hi all...

I have a column that contains names in upper case like:


and i wat it to be like:

Joe, Last Name
Thomas Jeferson Mors
Mike Lee

Any hint???

Re: Interesting Update Query

*** wrote/escribió (27 Jun 2005 01:42:49 -0700):
Quoted text here. Click to load it

Main : Function Reference : String Functions : strtolower

    Make a string lowercase
    available since: PHP 3, PHP 4 , PHP 5

    string strtolower ( string str )

Main : Function Reference : String Functions : ucwords
    Uppercase the first character of each word in a string
    available since: PHP 3>= 3.0.3, PHP 4 , PHP 5
    string ucwords ( string str )
Use a combination of both functions.

-- Álvaro G. Vicario - Burgos, Spain
-- - Mi sitio sobre programación web
-- Don't e-mail me your questions, post them to the group

Re: Interesting Update Query

 Ok, but i am trying a mysql only solution.

 The worst is that if i use a function that like locate() to find space
chars, it will only works for the first space char...

Alvaro G Vicario wrote:
Quoted text here. Click to load it

Re: Interesting Update Query said the following on 27/06/2005 10:50:
Quoted text here. Click to load it

You could spend ages writing a really complicated MySQL UPDATE query (it
might not even be possible, I don't know), or you could just use the
strtolower() + ucwords() combo before you INSERT data, or after you
SELECT data. Or alternatively, write a script that does a one-off
replace of all database records (i.e. SELECT -> PHP strtolower() +
ucwords() -> UPDATE).


Re: Interesting Update Query

I noticed that Message-ID: contained the following:

Quoted text here. Click to load it

and asking the question in comp.lang.php.


Geoff Berrow (put thecat out to email)
It's only Usenet, no one dies.
My opinions, not the committee's, mine.
Simple RFDs /

Site Timeline