Page 1 of 1

How do I update mySQL to have first letter uppercase?

Posted: Mon Mar 21, 2016 5:24 am
by simonmlewis
I need to update all the entries in a db field, so the first letter is UPPERCASE.
I've looked online and there seems to be a few ways, but each time i try it, it errors.

Code: Select all

mysql_query("UPDATE pages SET title = UC_Words(title) WHERE id = '$row->id'");
This doesn't work. I get the message:
[text]#1305 - FUNCTION website.CAP_FIRST does not exist [/text]
Is it because this is "old"??

Re: How do I update mySQL to have first letter uppercase?

Posted: Mon Mar 21, 2016 6:38 am
by Celauran
There is no MySQL function UC_Words. You will likely want to use UPPER and SUBSTRING.

Re: How do I update mySQL to have first letter uppercase?

Posted: Mon Mar 21, 2016 5:39 pm
by Christopher
I searched the Interwebs and found this pretty quickly:

http://www.artfulsoftware.com/infotree/ ... php?id=122