Re: [PHP-DB] UPDATE query
On Tue, Mar 8, 2011 at 11:16 AM, Ron Piggott wrote: > > I am wondering if there is a way to do an UPDATE query where only some of the > text changes. > > The column I need to modify is named “toll_free” > What I need to search for is: 800- > I need it to replace it with is 1-800- > - BUT I don’t want to change instances of 1-800- > - I need to leave the rest of the toll free phone number in tact. > Another example:: - update TABLE_NAME set FIELD_NAME = replace(FIELD_NAME, ‘find this string’, ‘replace found string with this string’); update client_table set company_name = replace(company_name, ‘Old Company’, ‘New Company’) The above statement will replace all instances of ‘Old Company’ to ‘New Company’ in the field of company_name of client_table table. -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP-DB] ucwords for mySQL?
Try this, $String = strtolower($String); or $String = strtoupper($String) then plug into MySQL Best, Karl On Mar 19, 2011, at 1:21 PM, Oddity Software LLC wrote: Need a custom function: BEGIN DECLARE c CHAR(1); DECLARE s VARCHAR(128); DECLARE i INT DEFAULT 1; DECLARE bool INT DEFAULT 1; DECLARE punct CHAR(17) DEFAULT ' ()[]{},.-_!@;:?/'; SET s = LCASE( str ); WHILE i < LENGTH( str ) DO BEGIN SET c = SUBSTRING( s, i, 1 ); IF LOCATE( c, punct ) > 0 THEN SET bool = 1; ELSEIF bool=1 THEN BEGIN IF c >= 'a' AND c <= 'z' THEN BEGIN SET s = CONCAT(LEFT(s,i-1),UCASE(c),SUBSTRING(s,i+1)); SET bool = 0; END; ELSEIF c >= '0' AND c <= '9' THEN SET bool = 0; END IF; END; END IF; SET i = i+1; END; END WHILE; RETURN s; END Regards, Will T Chief Technical Officer Oddity Software LLC http://www.odditysoftware.com -Original Message- From: Ron Piggott [mailto:ron.pigg...@actsministries.org] Sent: Saturday, March 19, 2011 1:05 PM To: php-db@lists.php.net Subject: [PHP-DB] ucwords for mySQL? I have found mySQL commands for LCASE and UCASE, but nothing equal to the PHP command “ucwords”. Is there a mysql command or will I need to use PHP to manipulate the strings? Ron The Verse of the Day “Encouragement from God’s Word” http://www.TheVerseOfTheDay.info -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php Karl DeSaulniers Design Drumm http://designdrumm.com -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP-DB] ucwords for mySQL?
Need a custom function: BEGIN DECLARE c CHAR(1); DECLARE s VARCHAR(128); DECLARE i INT DEFAULT 1; DECLARE bool INT DEFAULT 1; DECLARE punct CHAR(17) DEFAULT ' ()[]{},.-_!@;:?/'; SET s = LCASE( str ); WHILE i < LENGTH( str ) DO BEGIN SET c = SUBSTRING( s, i, 1 ); IF LOCATE( c, punct ) > 0 THEN SET bool = 1; ELSEIF bool=1 THEN BEGIN IF c >= 'a' AND c <= 'z' THEN BEGIN SET s = CONCAT(LEFT(s,i-1),UCASE(c),SUBSTRING(s,i+1)); SET bool = 0; END; ELSEIF c >= '0' AND c <= '9' THEN SET bool = 0; END IF; END; END IF; SET i = i+1; END; END WHILE; RETURN s; END Regards, Will T Chief Technical Officer Oddity Software LLC http://www.odditysoftware.com -Original Message- From: Ron Piggott [mailto:ron.pigg...@actsministries.org] Sent: Saturday, March 19, 2011 1:05 PM To: php-db@lists.php.net Subject: [PHP-DB] ucwords for mySQL? I have found mySQL commands for LCASE and UCASE, but nothing equal to the PHP command “ucwords”. Is there a mysql command or will I need to use PHP to manipulate the strings? Ron The Verse of the Day “Encouragement from God’s Word” http://www.TheVerseOfTheDay.info -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] ucwords for mySQL?
I have found mySQL commands for LCASE and UCASE, but nothing equal to the PHP command “ucwords”. Is there a mysql command or will I need to use PHP to manipulate the strings? Ron The Verse of the Day “Encouragement from God’s Word” http://www.TheVerseOfTheDay.info
Re: [PHP-DB] testing
On Fri, Mar 18, 2011 at 17:35, Jim Giner wrote: > first time poster There's no need to test. We've known it's worked for years. -- Network Infrastructure Manager http://www.php.net/ -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] testing
first time poster -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP-DB] Re: UPDATE query
to be correct you really should NOT append the 1 to any phone number. That "1" is not actually part of the number, it is merely a tool used by land-line phones that triggers the "long distance" feature. If you use a cell phone, you already know that you don't use a '1' when making a long-distance call. When one looks up a number you should provide them with the 10 digit number (in the U.S.) and let THEM figure out how to dial it. Suppose they are on an office phone system like the old Centrex ones where to get long distance, you had to get an outside line which meant dialing a 9 first. Are you going to add 9's to your numbers to? -- PHP Database Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php