Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 704227
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T03:55:05+00:00 2026-05-14T03:55:05+00:00

My apologies for asking such a novice question but, I need help building a

  • 0

My apologies for asking such a novice question but, I need help building a script using either PHP or directly in MySQL that can do the following:

  1. Take the values of a column in a table (text)
  2. Change them into capitalized words (from “this is a title” to “This Is A Title”)
  3. Replace the old values (uncapitalized) with the new values (capitalized).
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-14T03:55:06+00:00Added an answer on May 14, 2026 at 3:55 am
    1. MySQL doesn’t have a function like Oracle’s initcap – you have to create the function yourself:

      DELIMITER $$
      DROP FUNCTION IF EXISTS `test`.`initcap`$$
      
      CREATE FUNCTION `initcap`(x char(30)) RETURNS char(30) CHARSET utf8
      BEGIN
      
        SET @str='';
        SET @l_str='';
      
        WHILE x REGEXP ' ' DO
          SELECT SUBSTRING_INDEX(x, ' ', 1) INTO @l_str;
          SELECT SUBSTRING(x, LOCATE(' ', x)+1) INTO x;
          SELECT CONCAT(@str, ' ', CONCAT(UPPER(SUBSTRING(@l_str,1,1)),LOWER(SUBSTRING(@l_str,2)))) INTO @str;
        END WHILE;
      
        RETURN LTRIM(CONCAT(@str, ' ', CONCAT(UPPER(SUBSTRING(x,1,1)),LOWER(SUBSTRING(x,2)))));
      
      END$$
      
      DELIMITER ;
      

      Mind that the text length on the parameter is as long as your longest text field.

    2. Use an UPDATE statement:

      UPDATE TABLE 
         SET text_column = initcap(text_column)
      
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I apologize for asking such a generalized question, but it's something that can prove
Apologies or asking what is probably a very straightforward question, but I'm new to
apologies for not asking a strictly programming question, but this will move on to
This is extremely basic and I apologize for asking such a rookie question. But
Apologies for asking a related question yesterday, but after some sleep I've simplified my
Apologies in advance for asking such stupid questions, but: In Workflow for creating AIR
Apologies if I am asking a very trivial question... But I couldn't find the
Apologies for asking such a primitive question. I wrote a function which took one
Apologies for asking what is likely be a configuration related question, but I've been
I apologize in advance for asking such a stupid question, but how do I

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.