ZengCode.Com (The Thai Php Framework)  


Home   Download   Manual   About us    

Facebook   


MAIN MENU
News
Php Tips
Spring+Strut+Hibernate
Android Programming
Design Pattern By PHP
Ubuntu
Linux Quick Tips
C# Design Pattern
C# using Linq น่าใช้จริงๆ
C# Tips & Technique
Java & JavaScript Tips
Database & SQL
ZengCode Framework Guide
Zeng Code Code
Programming
IPhone (Tips and Trick)

Download เอกสารที่น่าสนใจ

     MySql replace string in a query  (2010-04-05)

 

 the mysql REPLACE function allows all sort of string manipulation, even inside statements :

REPLACE(str,from_str,to_str)

Returns the string str with all occurrences of the string from_str replaced by the string to_str.

 examples :

  • replace string in all records from a table :
     update mytable set myfield =  replace (myfield, "one", "two");
  • display a modified record set
    SELECT REPLACE(myfield, 'one', 'two') from mytable;


more info about string functions on mysql .com, be careful if you're using version 3, some functions appeared with version 4 

http://dev.mysql.com/doc/mysql/en/string-functions.html



Comment
Name
Comment
Security CodeCAPTCHA Image

web hit counter

This page took 0.053678 seconds to load.