php mb_convert_encoding

|

有老数据一个,数据还是mysql 3.x时的,哪时数据库还没有什么字符,都是latin1

程序也老,现在错误日志满天飞,一直也没有整理过,头大

近来这阵比较空想写个小程序接管一下,人老了正好动动脑可以防老,嘿嘿

使用 Adodb + Smarty

选取老数据库数据

$_sql = "select * from olddata.tables";
$db->Execute($_sql);
$_author = mb_convert_encoding($ors->fields['writer'],"utf-8","gb2312");
$_titler = mb_convert_encoding($ors->fields['title'],"utf-8","gb2312");
$db->query("set names utf8");
$_nsql = "INSERT INTO newdata.table(author,title) values('".$_author."','".$_title."')";
$db->Execute($_nsql);

mb_convert_encoding 要使用到 mbstring 库支持

嘿嘿... 不知这样效率如何

本想从数据库中用 mysqldump导入老数据再用 iconv来转换字符编码,不过总是有点小错误.

再一个,我想选择出想要的数据,去除不必要的字段,还有这样方便一点.

小记 备忘

About this Entry

This page contains a single entry by 清茶 published on May 21, 2008 3:35 PM.

在用的nginx的配置,不断更新完善 was the previous entry in this blog.

近来屁事多烦着呢!!! is the next entry in this blog.

Find recent content on the main index or look in the archives to find all content.

Powered by Movable Type 4.1