PHP Echo Tutorials

Make Column Lowecase or Uppercase

Written by phpecho.com   

For one reason or another you may wish to alter the content of a column in MySQL so that everything is lowercase.

In my situation, for instance, I had a database column of imported category URLs in PHP Link Directory that were like Dog-Lessons and Dog-Training and I wanted them to be dog-lessons and dog-training, so to fix this I did the following:

UPDATE table_name SET col_name = LCASE(col_name);

So, in the case of PHPLD, I would run:

UPDATE PLD_CATEGORY SET TITLE_URL = LCASE(TITLE_URL);
UPDATE PLD_CATEGORY SET CACHE_URL = LCASE(CACHE_URL);

Simple as that!

Obviously you can swap LCASE for UCASE to do the opposite.