Interesting Update Query

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • joealey2003@yahoo.com

    Interesting Update Query

    Hi all...


    I have a column that contains names in upper case like:


    JOE, LAST NAME
    THOMAS JEFERSON MORS
    MIKE LEE
    ..
    ..
    ..

    and i wat it to be like:

    Joe, Last Name
    Thomas Jeferson Mors
    Mike Lee


    Any hint???

  • Alvaro G Vicario

    #2
    Re: Interesting Update Query

    *** joealey2003@yah oo.com wrote/escribió (27 Jun 2005 01:42:49 -0700):[color=blue]
    > JOE, LAST NAME
    > THOMAS JEFERSON MORS
    > MIKE LEE[/color]
    [color=blue]
    > and i wat it to be like:[/color]
    [color=blue]
    > Joe, Last Name
    > Thomas Jeferson Mors
    > Mike Lee[/color]


    Main : Function Reference : String Functions : strtolower

    strtolower
    Make a string lowercase
    available since: PHP 3, PHP 4 , PHP 5

    usage:
    string strtolower ( string str )



    Main : Function Reference : String Functions : ucwords

    ucwords
    Uppercase the first character of each word in a string
    available since: PHP 3>= 3.0.3, PHP 4 , PHP 5

    usage:
    string ucwords ( string str )


    Use a combination of both functions.


    --
    -- Álvaro G. Vicario - Burgos, Spain
    -- http://bits.demogracia.com - Mi sitio sobre programación web
    -- Don't e-mail me your questions, post them to the group
    --

    Comment

    • joealey2003@yahoo.com

      #3
      Re: Interesting Update Query


      Ok, but i am trying a mysql only solution.

      The worst is that if i use a function that like locate() to find space
      chars, it will only works for the first space char...




      Alvaro G Vicario wrote:[color=blue]
      > *** joealey2003@yah oo.com wrote/escribió (27 Jun 2005 01:42:49 -0700):[color=green]
      > > JOE, LAST NAME
      > > THOMAS JEFERSON MORS
      > > MIKE LEE[/color]
      >[color=green]
      > > and i wat it to be like:[/color]
      >[color=green]
      > > Joe, Last Name
      > > Thomas Jeferson Mors
      > > Mike Lee[/color]
      >
      >
      > Main : Function Reference : String Functions : strtolower
      >
      > strtolower
      > Make a string lowercase
      > available since: PHP 3, PHP 4 , PHP 5
      >
      > usage:
      > string strtolower ( string str )
      >
      >
      >
      > Main : Function Reference : String Functions : ucwords
      >
      > ucwords
      > Uppercase the first character of each word in a string
      > available since: PHP 3>= 3.0.3, PHP 4 , PHP 5
      >
      > usage:
      > string ucwords ( string str )
      >
      >
      > Use a combination of both functions.
      >
      >
      > --
      > -- Álvaro G. Vicario - Burgos, Spain
      > -- http://bits.demogracia.com - Mi sitio sobre programación web
      > -- Don't e-mail me your questions, post them to the group
      > --[/color]

      Comment

      • Oli Filth

        #4
        Re: Interesting Update Query

        joealey2003@yah oo.com said the following on 27/06/2005 10:50:[color=blue]
        > Ok, but i am trying a mysql only solution.
        >
        > The worst is that if i use a function that like locate() to find space
        > chars, it will only works for the first space char...
        >[/color]

        You could spend ages writing a really complicated MySQL UPDATE query (it
        might not even be possible, I don't know), or you could just use the
        strtolower() + ucwords() combo before you INSERT data, or after you
        SELECT data. Or alternatively, write a script that does a one-off
        replace of all database records (i.e. SELECT -> PHP strtolower() +
        ucwords() -> UPDATE).

        --
        Oli

        Comment

        • Geoff Berrow

          #5
          Re: Interesting Update Query

          I noticed that Message-ID:
          <1119865800.860 151.21440@g14g2 000cwa.googlegr oups.com> from
          joealey2003@yah oo.com contained the following:
          [color=blue]
          > Ok, but i am trying a mysql only solution.[/color]

          and asking the question in comp.lang.php.

          O...K...

          --
          Geoff Berrow (put thecat out to email)
          It's only Usenet, no one dies.
          My opinions, not the committee's, mine.
          Simple RFDs http://www.ckdog.co.uk/rfdmaker/

          Comment

          Working...