Home >Backend Development >PHP Tutorial >php mysql string replacement method_PHP tutorial

php mysql string replacement method_PHP tutorial

WBOY
WBOYOriginal
2016-07-13 10:46:21773browse

This article shares an article about the method of replacing strings in php mysql. Students in need can refer to it.

The code is as follows
 代码如下 复制代码


function replace(){
$sql = db_query("SELECT field_languages_value,nid FROM {content_type_company_profile} WHERE

field_languages_value like '%Mandarin Chinese%'");
while($result = db_fetch_object($sql)){
$a = explode("Mandarin Chinese",$result->field_languages_used_value);
$b = $a[].'Chinese'.$a[1];
db_query("UPDATE content_type_company_profile SET field_languages_used_value = '%s' WHERE nid = %

d",$b,$result->nid);
}
}
?>

Copy code

function replace(){
$sql = db_query("SELECT field_languages_value,nid FROM {content_type_company_profile} WHERE

field_languages_value like '%Mandarin Chinese%'");
while($result = db_fetch_object($sql)){
$a = explode("Mandarin Chinese",$result->field_languages_used_value);
$b = $a[].'Chinese'.$a[1];
db_query("UPDATE content_type_company_profile SET field_languages_used_value = '%s' WHERE nid = %

http://www.bkjia.com/PHPjc/632942.html
www.bkjia.com
true
http: //www.bkjia.com/PHPjc/632942.htmlTechArticleThis article shares an article about the php mysql string replacement method. Students in need can refer to it. The code is as follows Copy the code ?php function replace(){ $sql = db_query(SELECT field_l...
Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn