Can the content of a field be sent to Capitalized?

Questions about the MySQL, PostgreSQL, and most other databases, as well as using it with PHP can be asked here.

Moderator: General Moderators

Post Reply
simonmlewis
DevNet Master
Posts: 4435
Joined: Wed Oct 08, 2008 3:39 pm
Location: United Kingdom
Contact:

Can the content of a field be sent to Capitalized?

Post by simonmlewis »

We have a table that has a $row->title field. I want to copy them all over to the "titletag" field. But I want to do it so it's in Capitalized format:

this is a field > This Is A Field.

Thankfully the words are not A, Is, To.... So it's fine. How do I do that?
Love PHP. Love CSS. Love learning new tricks too.
All the best from the United Kingdom.
User avatar
Celauran
Moderator
Posts: 6427
Joined: Tue Nov 09, 2010 2:39 pm
Location: Montreal, Canada

Re: Can the content of a field be sent to Capitalized?

Post by Celauran »

MySQL doesn't have a titlecase function, but you can write one in SQL or you can do it in PHP and bulk update.
simonmlewis
DevNet Master
Posts: 4435
Joined: Wed Oct 08, 2008 3:39 pm
Location: United Kingdom
Contact:

Re: Can the content of a field be sent to Capitalized?

Post by simonmlewis »

Yes - I guess I can copy them over, then do an update on all to be titlecase. Thanks anyway.
Love PHP. Love CSS. Love learning new tricks too.
All the best from the United Kingdom.
Post Reply