Articles Comments

{ Berbagi, Menulis, Dan Mengajar } Ilmu… » 7. Operating System » Replace String On MYSQL Function

Replace String On MYSQL Function

Sometime you might facing problem to replace the string or data in mysql and you have many row inside your table.  Here is the solution you can put in to SQL command line in phpmyadmin, this solution is work for mysql too.  Before begin please back all your sql 1st, in case you make any mistake.

Open phpmyadmin -> click on database -> click on table name -> click on SQL tab on top then enter the command below:

UPDATE tablename SET field = replace(field, "SearchString", "ReplaceString");

please change:
tablename
field
SearchString
ReplaceString

according your table name and field.
you can also add where Clause ( add condition for this sql statemen )

UPDATE tablename SET field = replace(field, "SearchString", "ReplaceString") WHERE field2='SomeValue';

Filed under: 7. Operating System

Leave a Reply

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>