MYSQL中的一个有关问题

WBOY
Release: 2016-06-13 13:34:52
Original
936 people have browsed it

MYSQL中的一个问题

PHP code
<!--

Code highlighting produced by Actipro CodeHighlighter (freeware)
http://www.CodeHighlighter.com/

-->

数据库中字段title这一列:

羽毛球YMQ
橄榄球GLQ
曲棍球QGQ


改成:

羽 毛 球 YMQ
橄 榄 球 GLQ
曲 棍 球 QGQ


Copy after login


应该怎么写呢?

------解决方案--------------------
PHP code

$a='羽毛球YMQ';



$b=preg_replace('/[A-Za-z](.*)/i','',$a);


$b1=str_split($b,2);

$b2=implode(" ", $b1);


$c=preg_replace("/".$b."/",'',$a);

//echo $c;

$result=$b2." ".$c;

echo $result;
<br><font color="#e78608">------解决方案--------------------</font><br>GBK 编码的?<br><br>mysql_select_db("new");<br>mysql_query("set names 'gbk'");//只要这一句<br><br>$a='羽毛球YMQ';<br>echo preg_replace('/[\x80-\xff]./', '$0 ', $a); <div class="clear">
                 
              
              
        
            </div>
Copy after login
Related labels:
source:php.cn
Statement of this Website
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
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!