473,394 Members | 1,748 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

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???

Jul 17 '05 #1
4 2072
*** jo*********@yahoo.com wrote/escribió (27 Jun 2005 01:42:49 -0700):
JOE, LAST NAME
THOMAS JEFERSON MORS
MIKE LEE and i wat it to be like: Joe, Last Name
Thomas Jeferson Mors
Mike Lee

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
--
Jul 17 '05 #2

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:
*** jo*********@yahoo.com wrote/escribió (27 Jun 2005 01:42:49 -0700):
JOE, LAST NAME
THOMAS JEFERSON MORS
MIKE LEE

and i wat it to be like:

Joe, Last Name
Thomas Jeferson Mors
Mike Lee

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
--


Jul 17 '05 #3
jo*********@yahoo.com said the following on 27/06/2005 10:50:
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...


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
Jul 17 '05 #4
I noticed that Message-ID:
<11*********************@g14g2000cwa.googlegroups. com> from
jo*********@yahoo.com contained the following:
Ok, but i am trying a mysql only solution.


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/
Jul 17 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Surendra | last post by:
I have this query that I need to use in an Update statement to populate a field in the table by the value of Sq ---------------------------------------------------------------------------- Inline...
2
by: Mike Leahy | last post by:
Hello all, This question is related to updating tables - is there any way to calculate or update the values in a column in a table to the values in a field produced by a query result? An...
10
by: Randy Harris | last post by:
I imported records into a table, later found out that many of them had trailing spaces in one of the fields. If I'd caught it sooner, I could have trimmed the spaces before the import. This...
4
by: deko | last post by:
I'm trying to update the address record of an existing record in my mdb with values from another existing record in the same table. In pseudo code it might look like this: UPDATE tblAddress SET...
8
by: Maxi | last post by:
There is a lotto system which picks 21 numbers every day out of 80 numbers. I have a table (name:Lotto) with 22 fields (name:Date,P1,P2....P21) Here is the structure and sample data: ...
7
by: Mark Carlyle via AccessMonster.com | last post by:
I have this update query that I am trying to run. I know the syntax is messed up but do not know how to correct it. Select 'UPDATE', Transactions,'Set = where = ' From "Get Daily Balances" ...
4
by: ward | last post by:
First off, thanks to those who assisted me with the nl2br() issue. Now here is another interesting "break." I brought up a record in my edit_task page, didn't make a change, and hit "submit." ...
4
by: Tony Toews [MVP] | last post by:
A client asked why some code behind a list box suddenly started updating 57386 records in a table instead of the expected 38 records. Turns out the problem is a difference in behavior between...
16
by: ARC | last post by:
Hello all, So I'm knee deep in this import utility program, and am coming up with all sorts of "gotcha's!". 1st off. On a "Find Duplicates Query", does anyone have a good solution for...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.