How to take advantage of the first letter of each word in Mysql

Hello

I tried to put a large database where visitors have been botched when entering text. The main thing I want to do is to capitalize the first letter of each word in Mysql.

I found the code below in PHP, but it continues to find an error on the TIME 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 mailing list and the column name is called, so I modified the script to do this: but it still shows the same error while:

<? PHP ini_set ('display_errors, 1');? >

<? php require_once('Connections/maison_connection.php');? >

<? PHP

$result = mysql_query ("SELECT name, id FROM mailing list");

While ($row = {mysql_fetch_array ($result))}

$id = $row ['id'];

$Name2 = ucwords ($row ['Name']);

$query2 = "UPDATE LISTSERV SET name = ' $Name2′ WHERE id = '$id" ";

mysql_query ($query2);

}

? >

Any ideas?


The key is to use a multidimensional array. The first time the while loop runs through the database results, $i is 0, so the values are assigned to the $updates [0] ['id'] and $updates [0] ["Name"]. The following becomes $updates [1] ['id'] and $updates [1] ["Name"] and so on.

The loop resets $i to 0, and uses count ($updates) to get the length of the array. It then updates each row by using $updates [0] ["Name"] and $updates [0] ['id'], $updates [1] ["Name"] and $updates [1] ['id'] and so on.

Tags: Dreamweaver

Similar Questions

  • Acrobat form - how to take advantage of the first letters of the words of field.

    I produced my first Acrobat form and am setting the validation rules on certain fields.  I want to ensure all names and addresses are saved with the first letter of each word being a capital as well as the letters are lower case.   While I found and read a few reviews, I have no script experience and positions assume a reasonable understanding of scripting, debugging, etc.

    Could someone please explain how I can achieve this.

    Thank you

    You must understand how the data will be entered and what you want to accomplish. If you want to have a function as title case, then you will need to adjust objects or other words that would not be capitalized. Users will use another character other than a space to separate words?

    Since it is an action of formatting, I would put the script as the custom format or a validation script, so that this code is not rerun each time a field used in a calculation is updated.

    Assuming that only a space character will separate the words, you can use the method '. split() ' to an array of words in the text entered in a field. You can then browse the array of words and affecting the first uppercase character and the rest of the word in lowercase, using the 'substr()' method or other methods of the property of type string.

    The simplest version of this could be:

    aInput var = event.value.split(""); make a table divided in space
    var sCharacter = ";
    Sword of var = ";

    for each element of the word table, uppercase the first letter
    for (i = 0; i
    aInput [i] = aInput [i] .substr (0, 1) .toUpperCase () + aInput [i] .substr (1). toLowerCase();
    } / / end of loop for the input string
    rebuild the input string with words changed with spaces
    Event.Value = aInput.join(' ');

    But since you will repeat this code in several areas, I would create document-level functions, so the code is in one place and be interpreted pre and run faster:

    function UpperCase (sString) {}
    Return sString.toUpperCase ();
    }

    function LowerCase (sString) {}
    Return sString.toLowerCase ();
    }

    function FirstUpperCase (sInput) {}

    aInput var = sInput.split(""); make a table divided in space
    var sCharacter = ";
    Sword of var = ";

    for each element of the word table, uppercase the first letter
    for (i = 0; i
    aInput [i] = uppercase (aInput [i] .substr (0, 1)) + LowerCase (aInput [i] .substr (1));
    } / / end of loop for the input string
    rebuild the input string with words changed with spaces
    Return aInput.join(' ');
    }

    You can then use the following code in each domain where you want to force the first character uppercase:

    Event.Value = FirstUpperCaseinputinputletter for (event.value);

    Another solution would be to use the following code in the format or validate the script:

    Event.Value = event.value.toLowerCase () replace (/ \b\w/g, function (match) {return match.toUpperCase () ;});})

    This script uses the RegEx object and its method of ". replace() ' using a self funciton set with the corresponding string.

  • Extract the first letter of each word

    Hi all

    I have a requirement to extract the first letter of each word as shown in the example below
    input: abcd output: a
    input: abcd efgh output: ae
    input: abcd efgh ijkl output: aej
    any help will be much appreciated

    I'm on the 11g version of the db

    Depends on your definition of a "word", but for example:

    SQL> select trim(regexp_replace(' a abcd efgh ijkl','(\S)\S*\s*','\1'))
      2  from dual
      3  ;
    
    TRIM(REGEXP_REPLACE('AABCDEFGH
    ------------------------------
    aaei
     
    
  • How the auto uppercase the first letter of each sentence

    I use the latest version of the Pages on the Sierra of the OS and I am trying to find a way to automatically capitalize the first letter of each sentence with nothing doesn't. I've been a user of Pages for years and every time announced a new update is all what I care about is adding this feature simple but important. So, now that the new update is here I can not yet understand how to take advantage of the auto and I can't find workarounds online to help me do it. Any idea?

    You can use WordService from DEVONtechnologies, free in the Mac App Store. You can then go to System Preferences > keyboard > shortcuts > Services & enable those you want. You can then select the text you want to apply the service to & go to Pages > Services & select initial caps of sentences. It is also possible to assign a keyboard shortcut to services. With the help of this device, or similar functionality in any word processing application still not to revert to words in a sentence that should be capitalized as 'I' or pronunciations. You will also have the problem of it capitalized words after the period for the abbreviation.

    I do it the traditional way, using the SHIFT key when necessary. It is advisable to learn to type using the SHIFT key, rather than relying on the software to do it for you. Just like the use of a spellchecker. It's good, but it will not go back on the words that are spelled correctly but not the correct spelling of the situation.

  • On Windows 7, how to implementing automatic uppercase the first letter of the first book and the first letter after each period?

    I'm using Windows 7, how do I configure my system automatically capitalized the first letter of the first word and the first letter after each period?

    Thank you

    Lisa.

    Hello Lisa,.

    It's more to do with the word processor on Windows. You don't say what word processing software you use. If you use WordPad which comes free with Windows, it is impossible to do what you want to do. However, if you are using Microsoft Office Word (that you can buy) then the CAP is set by default.

    This forum post is my own opinion and does not necessarily reflect the opinion or the opinion of Microsoft, its employees or other MVPS.

    John Barnett MVP: Windows XP Expert associated with: Windows Expert - consumer: www.winuser.co.uk | vistasupport.mvps.org | xphelpandsupport.mvps.org | www.silversurfer-Guide.com

  • Capitalize first letter of each new sentence

    Hi guys,.

    I'm working on a drawing or model for a magazine that, for now, I need to type a large number of texts in InDesign instead of copy - paste from word or...

    It made me a bit annoyed because I don't get uppercase every first letter of each sentence automatically like Word etc?

    So: How can I automatically uppercase the first letter of each sentence?

    Thank you very much

    Bob

    Edit/Preferences/correction auto/enable auto/correction correction automatic capitalization errors.

  • First character of each word

    Hi all

    I want to get the first character of each word:

    If I "Statement analysis", so I want a query to return PBTS.


    Your help please

    Hello

    Here's one way:

    SELECT     REGEXP_REPLACE ( INITCAP ('Statement to be PARSED')
                     , '[^A-Z]'
                     )     AS inits
    FROM    dual;
    

    Output:

    INIT
    ----
    STBP
    

    INITCAP is an easy way to capitalize the first letter of each word (and ensure that no other letters begin with a capital letter).
    REGEXP_REPLACE is an easy way to delete all the characters except the captial letters.

  • Get rid of the rule of the first letter in paragraph targeted

    Hello

    I have the following rule, which defines the color of the first letter of each of my paragraphs:

    p:first - letter {}

    make-weight: bold;

    Color: #F00;

    do-size: 36px;

    }

    I want one of my paragraphs to not have this style applied to it, so I assigned a class (< class p 'caveat' = >, the following:)

    #mainContent caveat {}

    background-color: #09F;

    color: #FFF;

    text-align: center;

    font size: large;

    make-weight: bold;

    }

    Unfortunately, she styles everthing in the rule except the rule of the first letter. This paragraph still seems to be to inherit this rule.

    How can I get rid of the rule of the first letter of the paragraph?

    Thank you

    Add

    {p.caveat:first - letter #mainContent

    color: #FFF;

    font size: large;

    }

    GRAMPS

  • I'm a new student in my second semester. How can I take advantage of the student price?

    When I installed everything first Creative Cloud I wasn't a student, so I had to pay full price. Recently, I am majoring in graphic design at my local community college and would like to take advantage of the student discount. How can I switch to student price so I can get all the desktop applications that I need?

    Hello

    Please contact Adobe customer support. Make sure you have a certificate of validation that you're a student. They can ask to send it.

    Contact the customer service

  • My Whatsapp stopped suggesting words when I type the first letter how can I turn that back on FRO my six phone

    My WatsApp has stopped which suggests words when I type the first letter (s) how can I turn that on the back for my six phone more?

    Try: Settings > general > keyboard > predictive

  • If someone checks the mail from yahoo to my computer, their code is displayed if the first letter from my ID is the same with theirs. How can I delete their history on my computer?

    If someone checks the mail from yahoo to my computer, their code is displayed if the first letter from my ID is the same with theirs. How can I delete their history on my computer?

    Hey ioanaatc,

    Go in Tools > Options > Security tab click on passwords saved. This will give you a list of sites that you have saved passwords yahoo just find and delete other connections

    There are a lot of useful information in this article on the Firefox Password Manager. He should answer any other questions you might have.

    It can be saved as Auto form fill data. If this is the case, the article I just linked will show you you how to remove these entries as well.

    Hope this helps!

  • My saved favorites does not appear on the html bar when I typed the first letter! He appeared and now it does not work! How and what do I do?

    Help! My saved favorites does not appear when I type in the first letter. For an example, I saved "www.facebook.com" as one of my favorites. Whenever I go into facebook, I'll just enter the letter 'f' and he goes, a drop down link in the html bar then I'm leaving for facebook! But recently there have not been showing bookmarks I saved. I reinstalled firefox and it does not solve the problem at all. How and what do I do?

    Make sure that the address bar is not set to 'Nothing': Tools > Options > privacy > address bar: when you use the location bar, suggest: history, bookmarks and bookmarks - see Smart Location Bar

  • How to select files in a directory by typing the first letter of the name as in 95 - &#62; XP

    How to select files in a directry by typing the first letter of the name as in XP

    Something has changed on my copy of Vista 64 bit Home Premium edition, and now when I try to type the first letter of a name of file to access it, rather Vista puts in the search box in the upper right corner of the window.

    It's counterproductive and annoying _ out of me. I want to jump for filenames beginning with that letter, not clear the screen and show the stuff that is not in the current directory. Especially since I regularly work with earlier versions of windows.

    How should I do so that I can type in the names of files in Explorer and jump to files beginning with this letter as in all previous versions of Windows since at least win95?

    Go to start / Control Panel / folder Options / view and scroll down where it presents two options when entering in the list view.  Check the box to select the item type in the view.  This is part of what you want.

    If you type a letter, it will go to the files/folders starting with this letter (and not the search box); However, I just tried it myself and it seems to work only for the first letter.  If you type in a second letter, he will then the files/folders starting with THIS letter instead of files that begin with the first letter typed and then refining to files beginning with the two first letters typed and so on.  I can't make it work any better than this - unless I type really fast (and it seems to work as it should most of the time).  And I want really fast.

    I hope this helps.

    Good luck!

    Lorien - MCSA/MCSE/network + / has + - if this post solves your problem, please click the 'Mark as answer' or 'Useful' button at the top of this message. Marking a post as answer, or relatively useful, you help others find the answer more quickly.

  • Hello, I would like to take advantage of the promotions on Adobe Photoshop for a single user (valid until tomorrow), but I have two questions.  First of all, I intend to buy a new computer for a month and for the moment, I don't know if it will be

    Hello, I would like to take advantage of the promotions on Adobe Photoshop for a single user (valid until tomorrow), but I have two questions.  First of all, I intend to buy a new computer for a month and for the moment, I don't know if it will be a pc or a mac. Do I have to decide at the time of the purchase, what system I'll use?  Secondly, I also have a plan for about a month to open an individual company. If I buy the program as a person, could I then use it as a business?

    Creative cloud is cross-platform. Licensing is not serious. By definition, an "enterprise" might as well be a single person. It is totally irrelevant, as long as you purchase a full license appropriate regardless of any promotion.

    Mylenium

  • How can I configure FF to start typing before? Such as if I am on a Web Site that needs my personal info, I put in the first letter of my email and FF puts the rest?

    How can I configure Firefox to start typing before? Such as if I am on a Web Site that needs my personal info, I put in the first letter of my e-mail and Firefox puts in the rest of the letters? IE has implemented this. It makes just so typing more easy to personal information.

    Firefox has a 'rudimentary' fill or "AutoComplete" feature, which is linked to the history of form and research.

    https://support.Mozilla.org/en-us/KB/control-whether-Firefox-automatically-fills-forms

    https://support.Mozilla.org/en-us/KB/Firefox-doesn ' t-economy-web-form-entries

    Users should be cautious to they clear recent history what they deselect Form & Search History; This data is stored in its own cache and not saved in a data file.

    As Fred mentioned, using an 'auto fill' extension is preferred by many users. This type of extension allows user implement their data of a personal nature and then to have this 'auto fill' information as required on the Web page "Forms."

    Currently, the most popular "auto-fill" extension seems to have disappeared of Addons,Mozilla.Org site in the last day or two. I had seen a number of threads of support on a compatibility issue in Firefox 50 with this extension; and I suspect that the developer he shot the AMO site. Not sure if this developer will solve the compatibility problem (probably several processes) prepares a new extension to the new format of WebExtensions, or that it is right to give up with his "auto-fill" extension I saw it listed in the AMO Tuesday; Today, it's gone.

    Personally, I have little use for this type of extension, but I don't use and provide suggestions of development (aka criticize what they were doing, FRO the view of "long term user") for a "auto-fill" extension of return in 2004 in the run-up to the release of Firefox 1.0. These developers have created what I would call an add-on "cutting edge", but ran into problems of compatibility silly every week because of Mozilla. And by the time Firefox 1.5 came out 6 months later and 1.5 changes to this extension, developers just gave and 'we' lost this particular extension. After using the 'ultimate auto-fill' extension I've tried a few others, but they have failed in comparison; and since my need was not great I just stuck with the function 'auto' by default.

    It's a real shame that Mozilla has not seen fit to extend these basic features "AutoComplete" over the past 10 years; but hey, it's software development! Redo the UI repeatedly and ignore the basic features; who looks better on a RESUME "as"scut"work that few potential employers will enjoy.

Maybe you are looking for