How to Capitalize the First Letter in Every Word in Mysql

Hi,
I have been trying to tidy up a massive database where visitors have been sloppy when entering text. The main thing I want to do is to Capitalize The First Letter In Every Word In Mysql.
I have found the code below in PHP but it keeps finding an error on the WHILE line:
<?php ini_set('display_errors', '1'); ?>
<?php require_once('Connections/maison_connection.php'); ?>
<?php
$result = mysql_query ("SELECT column, id FROM table");
while ($row = mysql_fetch_array($result)) {
$id = $row["id"];
$column2 = ucwords($row["column"]);
$query2 = "UPDATE table SET column = '$column2′ WHERE id = '$id'";
mysql_query($query2);
?>
My table is called MailingList and the Column is called Name, so I have altered the script to this: but it still shows the same WHILE error:
<?php ini_set('display_errors', '1'); ?>
<?php require_once('Connections/maison_connection.php'); ?>
<?php
$result = mysql_query ("SELECT Name, id FROM MailingList");
while ($row = mysql_fetch_array($result)) {
$id = $row["id"];
$Name2 = ucwords($row["Name"]);
$query2 = "UPDATE MailingList SET Name = '$Name2′ WHERE id = '$id'";
mysql_query($query2);
?>
Any ideas??

I got it to work this way in SQL: I am SURE there is an abbreviated way to do it, but at least it works
UPDATE MailingList SET Name = replace(Name," a"," A");
UPDATE MailingList SET Name = replace(Name," b"," B");
UPDATE MailingList SET Name = replace(Name," c"," C");
UPDATE MailingList SET Name = replace(Name," d"," D");
UPDATE MailingList SET Name = replace(Name," e"," E");
UPDATE MailingList SET Name = replace(Name," f"," F");
UPDATE MailingList SET Name = replace(Name," g"," G");
UPDATE MailingList SET Name = replace(Name," h"," H");
UPDATE MailingList SET Name = replace(Name," i"," I");
UPDATE MailingList SET Name = replace(Name," j"," J");
UPDATE MailingList SET Name = replace(Name," k"," K");
UPDATE MailingList SET Name = replace(Name," l"," L");
UPDATE MailingList SET Name = replace(Name," m"," M");
UPDATE MailingList SET Name = replace(Name," n"," N");
UPDATE MailingList SET Name = replace(Name," o"," O");
UPDATE MailingList SET Name = replace(Name," p"," P");
UPDATE MailingList SET Name = replace(Name," q"," Q");
UPDATE MailingList SET Name = replace(Name," r"," R");
UPDATE MailingList SET Name = replace(Name," s"," S");
UPDATE MailingList SET Name = replace(Name," t"," T");
UPDATE MailingList SET Name = replace(Name," u"," U");
UPDATE MailingList SET Name = replace(Name," v"," V");
UPDATE MailingList SET Name = replace(Name," w"," W");
UPDATE MailingList SET Name = replace(Name," x"," X");
UPDATE MailingList SET Name = replace(Name," y"," Y");
UPDATE MailingList SET Name = replace(Name," z"," Z");

Similar Messages

  • How to capitalize the first letter of each  word in a sentence?

    Can anyone please explain how to split a sentence at a comma, or space or hyphen in to words and capitalize the first letter of each word. But I don't know how many words the sentence contains.

    HI,
    data : begin of itab occurs 0,
             words(40),
             end of itab.
    data : v_sentence(1000).
    data : lv_firstchar.
    split v_sentence at ',' into table itab.
    loop at itab.
    translate itab-words+0(1) to upper case.
    modify itab index sy-tabix.
    endloop.

  • Is there a way to auto capitalize the first letter of every word?

    I Like To Type In This Way. I Was Wondering If There Is A Setting That Will Automatically Capitalize The First Letter Of Each Word So That I Don't Have To Keep Hitting Shift Before Each First Letter.
    Thank You

    AdamMarshall wrote:
    Nice to see so many 'helpful' responses.
    This casing is useful for example, on an Address field. It would be good if the OS had this option for developers.
    I'm pretty sure it does as I've certainly had apps that, in certain fields, do use title case.

  • Can iTunes capitalize the first letter of every word?

    I know there are id3 tag software for this but they are confusing and all that i have tried have all messed up my music. I like it organized. I just want everythign capitalized and if I look at my music in windows explorer i just want to see...
    Tr# Title
    01 Stairway To Heaven
    I have it all organized in folders so i dont need anything else. But i just want to capitalize everything can itunes do this? thanks.

    Try searching VersionTracker for "tag editor" and perhaps you'll come up with something you can use.
    Oh, and I really don't mean this as a flame, but you waited less than twelve hours, most of those being the wee hours of the morning in the US. So you weren't likely to get a response during those times. Just to set expectations for future posts. Cheers.
    Message was edited by: Dave Sawyer

  • How to Capitalize the first letter or an entire word using a shortcut on the keyboard just like in microsoft that uses shift+F3

    please how can one How to Capitalize the first letter or an entire word using a shortcut on the keyboard just like in microsoft that uses shift+F3

    What do you mean there was "no effect?" I'm not aware of any effects.
    It looks like that Service is also in the App Store. From their screen shots, the services are prefaced with WordService:
    You can see an example in the App Store for their app: App Store
    After installing, you should now have those text services in your Services menu. You can then add shortcuts in the Keyboard System Prefs.
    Most Apple apps have a Transformations menu in the Edit menu. You can Make upper, lower, and Initial caps with those. I would stick with Word Services, but you can make Application Shortcuts for the items in the Transformations menu.
    Again, in Keyboard System Prefs, Under Applications, Click the Add button on the right side pane.
    Set it for All Applications
    Enter the menu command exactly as they appear in the Transformation menu (separate entries for each),
    Make Upper Case
    Make Lower Case
    Capitalize
    Give them a shortcut.

  • How to capitalize the first letter

    Yesterday, I upgraded my operating system and pages on my Mac.  However, I can't capitalize the first letter after every sentence.  Can you please help me with this problem of mine? 
    Thank you,
    Vic.   

    I have the same problem. For the previous Pages, the problem is solved by +Menu > Preferences > Auto-Correction Preferences > check Fix Capitilization+. For this update I cannot find any solution!

  • Making the first letter of every word a capital

    hello CF oracles
    could you guys please advise me the best way to make the
    first letter in every word of a string a capital letter. (and make
    all the other letters lower case).
    eg. convert "the quick brown fox" into "The Quick Brown Fox"
    or convert "THE QUICK BROWN FOX" into "The Quick Brown Fox"
    I am taking form data and inserting it into my table, so i
    want to get it right as the data is inserted.
    i found a "UDF" on CFLIb.org that proports to do this, but i
    don't know how to set up a UDF, are there other ways or is this
    considered the best approach.
    http://www.cflib.org/udf.cfm?id=9&enable=1
    thanks for any help you can give me

    found it, here's the top info, Titlecase is what you want for
    this.:
    changecase.cfm
    Rev 1.01
    cf_changecase is a simple custom tag to format case in given
    string.
    (c) 2001, Rizal Firmansyah, [email protected]
    Input var:
    * case (mandatory)
    possible inputs are
    - sentencecase: Sentence case (default)
    - titlecase: Title Case
    - lowercase: lowercase
    - uppercase: UPPER CASE
    "happysailingdude" <[email protected]> wrote
    in message
    news:e46tjv$e30$[email protected]..
    > hi Dan thanks very much. I have made an executive
    decision to do a bit of
    > a
    > hack for now as my site is only small so if a user
    enters something in the
    > wrong way i can quickly manually update it myself.
    >
    > so now i have this which works 9 times out of ten if the
    user enters a one
    > word name eg "bill" or "fred" of "jane" then it works
    just fine
    >
    > the only time it doesnt work is if the user's name is
    more than 1 word (or
    > is
    > hyphenated) eg "mary anne" or "anne-marie" hence the
    first cfif line - in
    > these
    > cases i can manually update
    >
    > i put this here in case it is of use to anyone else
    >
    > cheers
    >
    > <cfif not (FORM.firstName contains " " or
    FORM.firstname contains "-")>
    > '#Left( UCase( "#FORM.firstName#" ), 1 )##Right( LCase(
    > "#FORM.firstName#" ), Len("#FORM.firstName#" ) - 1 )#'
    > <cfelse>
    > '#FORM.firstName#'
    > </cfif>
    >

  • Is there a command to capitalize the first letter of each word?

    That is to say, can you capitalize the first letter of each word in a document like say, word? Or using the net?
    Thanks guys.
    (hope that makes sense.)

    Select the text, then Format->Change Case->Title Case (Word 2004).

  • How to Capitalize the first letter in a text field?

    I have a text field of first_name and one of last_name.  I want to make sure not matter what format the user inputs the the first letter is Capitalized and the rest is lower case.  Can someone tell me how this is done?  Thanks!

    Rick4209 wrote:
    I have a text field of first_name and one of last_name.  I want to make sure not matter what format the user inputs the the first letter is Capitalized and the rest is lower case.  Can someone tell me how this is done?  Thanks!
    It depends on what you want to do with the name. If this is for inserting the name in a database and you're using PHP, it's very simple:
    $name = 'DaVID';
    $formatted = ucfirst(strtolower($name));
    echo $formatted; // outputs 'David'
    This nests two functions: the inner function, strtolower(), converts everything to lowercase, and the outer function, ucfirst(), converts the first letter to uppercase.

  • Is their a way to turn on auto-capitalization of the first letter of every word??

    i want da first letter to be in caps without me pressing caps lock or using shift
    i.e Like This But Without Using Those Two Keys

    There have been some threads here about large-scale deployment, but I don't know whether they would help after Firefox has been installed.
    Random thought:
    I suspect (but haven't checked) that changing the "Clear Recent History" options would add corresponding entries to prefs.js in the user's profile folder. (These usually are added during Firefox shut-down.) That's just a plain text file and you could append to it by a variety of means.
    It might be possible to use a VBScript during logon to update that file before the user starts Firefox. The script would have to detect the random folder name(s) in order to make the update.

  • Capitalize the first letter?

    Is there a way in CF to capitalize the first letter of a
    word?

    cf_dev2 wrote:
    > One way is using string functions. Left() to grab the
    first letter and
    > UCase() to capitalize it. You can use Right() and Len()
    to grab the rest of
    > the word.
    >
    > You can see an example of something similar at
    cflib.org. But read the usage
    > on how it operates if you pass multiple words.
    >
    http://www.cflib.org/udf.cfm?ID=9
    >
    Perfect. Thank you!

  • Capitalize the first letter after full stop.

    Since I m not a Java Programmer, my speciality is PERL. I m looking
    for a little support from any of the Javascripts Gurus here. Its
    going to take 5 or less minutes for you to solve this issue.
    I have a textbox and I want when users are typing in it. The word
    after full stop (.) will be capitalized just like MS-Word. I mean
    the begining of the new sentence with capital letter, users don't
    have to push "shift" button to capitalize the first letter after
    every full stop .
    thanks for your help.
    Any Ideas,
    Zeshan.

    Try Google. Have you heard of it? www.google.com
    do a search!

  • FM to translate first letter of every word to upper case.

    Hi all,
    I have a requirement to change the first letter of every word in sentence to Upper case.For example if the sentence is 'fifty eight thousand' it has to be changed to 'Fifty Eight Thousand'.Is there any FM to acheive this? Any help would be highly appreciated.
    Thanks and Regards
    Kiran.

    it is useful for u :
    FM:ISP_CONVERT_FIRSTCHARS_TOUPPER
    OR u can user below code:
    translate output_string to lower case.                 
      pos_max = strlen( output_string ) - 1.
      pos = 0.
      assign output_string+pos(1) to <poi>.
      assign input_string+pos(1)  to <hpoi>.
      <poi> = <hpoi>.
      assign input_string+pos(*) to <rest>.
      while <rest> ca separators.
        pos = pos + sy-fdpos + 1.
        if pos > pos_max. exit. endif.
        assign output_string+pos(1) to <poi>.
        assign input_string+pos(1)  to <hpoi>.
        <poi> = <hpoi>.
        assign input_string+pos(*) to <rest>.
      endwhile.

  • Auto-Capitalization: How can I set Pages v5.01 to auto-capitalize the first letter of the first word in a sentence and to automatically change lower case "i" to "I" appropriately. I'm unable to find a menu that offers me these.

    Auto-Capitalization: How can I set Pages v5.01 to auto-capitalize the first letter of the first word in a sentence and to automatically change lower case "i" to "I" appropriately. I'm unable to find a menu that offers me these.

    Gavin Lawrie wrote:
    Once it had been established that the iWork rewrite had resulted in some features being lost and others broken, and once Apple had acknowledged the concerns* and suggested they are working on fixes**, I'm not sure what else there is to achieve.
    You are writing that in the perspective of having read about it here already. Repeated often enough that you encountered it somewhere in the posts.
    Users are flooding in here and don't know any of this. Of course we have to repeat everything endlessly.
    Because I like to give precise, understandable and workable answers to repeated questions, and Apple doesn't allow sticky posts here, I created a separate forum which users can consult to look up real answers, and contribute for themselves if they have something valuable to add:
    http://www.freeforum101.com/iworktipsntrick/
    There is a section purely devoted to Pages 5. Add whatever answers you feel will lighten the problems of Apple's 'upgrades'.
    Peter
    * Where have they acknowledged anything?
    ** They have barely anything listed, compared to the massive list of deleted features, and nothing but an extraordinarily long time frame considering they created the problems here and now. Apple has not said they will do anything at all about fixing the real issues, the biggest of which is that the new iWork apps break virtually all the work of existing users.

  • How to enable capitalize the first letter?

    As the title said, is there a way to make mac capitalize the first letter universally in the system, in the textedit, mail, .....?? Just like what iphone and ipad can do. Any ideas are welcome. Thank you.

    Gavin Lawrie wrote:
    Once it had been established that the iWork rewrite had resulted in some features being lost and others broken, and once Apple had acknowledged the concerns* and suggested they are working on fixes**, I'm not sure what else there is to achieve.
    You are writing that in the perspective of having read about it here already. Repeated often enough that you encountered it somewhere in the posts.
    Users are flooding in here and don't know any of this. Of course we have to repeat everything endlessly.
    Because I like to give precise, understandable and workable answers to repeated questions, and Apple doesn't allow sticky posts here, I created a separate forum which users can consult to look up real answers, and contribute for themselves if they have something valuable to add:
    http://www.freeforum101.com/iworktipsntrick/
    There is a section purely devoted to Pages 5. Add whatever answers you feel will lighten the problems of Apple's 'upgrades'.
    Peter
    * Where have they acknowledged anything?
    ** They have barely anything listed, compared to the massive list of deleted features, and nothing but an extraordinarily long time frame considering they created the problems here and now. Apple has not said they will do anything at all about fixing the real issues, the biggest of which is that the new iWork apps break virtually all the work of existing users.

Maybe you are looking for

  • Adobe CS4 Install freezes at "Preparing to Install..." on Vista

    I am trying to install Adobe CS4 for the first time (it's not an upgrade) from DVD on Vista (all the latest updates are installed; Windows Update has nothing more to do). The Vista install is also pretty fresh, although I have installed a few things.

  • Premiere CC 7.1 - Red frames in playback and export

    Having some problems after the 7.1 update. In a variety of projects, on a variety of footage, we're experiencing random fully red frames (#ff000). Sometimes there are 1-2 frames in a clip, and occaisionally it's 80%-90% of the frames in a clip (this

  • Sending a html email with jsp

    is it possible to send an email with html content and how do i do that

  • (hr)problem with time-event upload

    hi friends, flowing codes like rpteup10 program. but we changed it. (december 2005) . but now there is problem not working . it is writing done but infotype 2011 from pa20 there is no change. maybe problem is fm HR_CC1_TIMEEVENT_INSERT. please help m

  • Can i change the resoulution of my pictures in iphoto

    can i change the resoulution of my picture in iphoto from 1.7 Mb to 1MB or less so i can post it online?