izbryte Posted August 22, 2008 Share Posted August 22, 2008 I have a checkbox field in a mysql database that is fed through a form on a website and I accidentally forgot to capitilize the first letter (word should be Word). It is part of an array. Now there are 100's of listings. Is there an easy way for me to go in change them all at one time in phpmyadmin? Link to comment https://forums.phpfreaks.com/topic/120927-change-case-in-a-mysql-db/ Share on other sites More sharing options...
cooldude832 Posted August 22, 2008 Share Posted August 22, 2008 ucwords in php can solve this. Link to comment https://forums.phpfreaks.com/topic/120927-change-case-in-a-mysql-db/#findComment-623346 Share on other sites More sharing options...
akitchin Posted August 22, 2008 Share Posted August 22, 2008 there's no handy function, according to the manual, to do this in a MySQL query, but you can use a combination of them: UPDATE table SET field=CONCAT(UPPER(LEFT(field, 1)), RIGHT(field, CHAR_LENGTH(field) - 1)) this will set field equal to the uppercase version of the first character followed by the remainder of the value as it was. i would duplicate your data into a test table to check that it works there first, before you go and operate this directly on your dataset. Link to comment https://forums.phpfreaks.com/topic/120927-change-case-in-a-mysql-db/#findComment-623353 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.