Jump to content


Photo

Search and replace in mySQL, how to?


  • Please log in to reply
1 reply to this topic

#1 zinnerz

zinnerz
  • New Members
  • Pip
  • Newbie
  • 1 posts

Posted 11 July 2006 - 07:13 PM

Dear friends,

I want to doing mass replace in order to change smiley code in all posts, example:

(the text is in post table > text row)
you're very funny :smiley1:

How to replace all :smiley1: to :funny: in entire post?

Thanks before :)

#2 Wildbug

Wildbug
  • Members
  • PipPipPip
  • Advanced Member
  • 1,149 posts

Posted 11 July 2006 - 07:34 PM

From the MySQL manual -- string functions:

REPLACE(str,from_str,to_str) 

Returns the string str with all occurrences of the string from_str
replaced by the string to_str. REPLACE() performs a case-sensitive
match when searching for from_str. 

mysql> SELECT REPLACE('www.mysql.com', 'w', 'Ww');
        -> 'WwWwWw.mysql.com'

This function is multi-byte safe.

Twice a day my clock works PERFECTLY!  I can't figure out what's wrong with it.




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users