Home  >  Article  >  Backend Development  >  MYSQL中的一个有关问题

MYSQL中的一个有关问题

WBOY
WBOYOriginal
2016-06-13 10:18:02994browse

MYSQL中的一个问题

PHP code
<!--Code highlighting produced by Actipro CodeHighlighter (freeware)http://www.CodeHighlighter.com/-->数据库中字段title这一列:羽毛球YMQ橄榄球GLQ曲棍球QGQ改成:羽 毛 球 YMQ橄 榄 球 GLQ曲 棍 球 QGQ


应该怎么写呢?

------解决方案--------------------
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>
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