Need Help Stringing Some Php Commands Together

Ask about general coding issues or problems here.

Moderators: macek, egami, gesf

Post Reply
seandisanti
php-forum Fan User
php-forum Fan User
Posts: 973
Joined: Mon Oct 01, 2012 12:32 pm

Re: Need Help Stringing Some Php Commands Together

Post by seandisanti » Wed Oct 03, 2012 9:04 am

it's not as readable, but you can nest your replace statements so that the return of one is used as the primary string for the next. luckily since whitespace doesn't matter your code can kind of reflect the nesting so it's easier to keep track of. here's an example doing 3 replacements in one line.

Code: Select all

UPDATE 'property'  SET 'description' = replace(
											replace(
												replace('description',"é", "e")
											,"á", "a"),
										"St.", "St ");

***edit***
fixed typo

Post Reply

Who is online

Users browsing this forum: Yahoo [Bot] and 1 guest