homepage Welcome to WebmasterWorld Guest from 54.211.47.170
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Pubcon Platinum Sponsor 2014
Home / Forums Index / Code, Content, and Presentation / Databases
Forum Library, Charter, Moderators: physics

Databases Forum

    
Replace text
Replace text in multiple rows
TheKiller




msg:4416851
 11:16 pm on Feb 12, 2012 (gmt 0)

Well hello,

I know you may replace text from a sql table by using something like the fallowing:

UPDATE phpbb_posts SET post_text = replace(post_text, 'Î', '');

But would there be a way to replace something from two rows at once?

Something ilke this:

UPDATE phpbb_posts SET post_text, post_subject = replace(post_text, post_subject, 'ă', ';');

I know there could be just a second update line of code that does that separtely, but can you do it from just one line?

Like you do for example:

UPDATE phpbb_topics SET topic_time = '1329086612',topic_views = '0' WHERE topic_id =747 ;

Thanks in advance.

 

Dijkgraaf




msg:4426693
 10:58 pm on Mar 8, 2012 (gmt 0)

Yes, you can set multiple columns at a time and accross multiple rows
UPDATE phpbb_posts
SET post_text = replace(post_text, 'ă', ';'),
post_subject = replace(post_subject, 'ă', ';')
WHERE ...;

TheKiller




msg:4449693
 12:22 am on May 5, 2012 (gmt 0)

Thanks mate. I dont need it anymore as i just wanted to help a forum owner that has messed up his db.

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Code, Content, and Presentation / Databases
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved