GNUBOARD备用彩排练习
仔细接收备份后(??)将现有DB从EUC-KR转换为UTF8,
我用EditPlus打开它,包括在编码中可能会丢失的字符据说是
忽略它,将其更改为UTF8并导入… 。 该死的不是因为字母损坏
最终急忙~~~~,我看不到该方法。
(在倾倒时,您无法为–Default-Character-Set提供所有选项。)
不可避免地会发现以下来源,将其修改以适合您的口味(UTF8转换,选择所需的桌子)
以前的确认完成了!!! - 我也厌倦了搬迁。
[PHP]
$mysql_host = '********';
$mysql_db = '********';
$mysql_user = '********';
$mysql_pass = '********';
$fileName = 'db-backup';
$extention = "sql";
// 필요한 테이블만~
$select[] = 'g4_board';
$select[] = 'g4_board_file';
$select[] = 'g4_board_good';
$select[] = 'g4_board_new';
$select[] = 'g4_config';
$select[] = 'g4_group';
$select[] = 'g4_group_member';
$select[] = 'g4_write_cast';
$select[] = 'g4_write_delphibbs';
$select[] = 'g4_write_english';
$select[] = 'g4_write_girl';
$select[] = 'g4_write_gy';
$select[] = 'g4_write_humor';
$select[] = 'g4_write_module';
$select[] = 'g4_write_mypage';
$select[] = 'g4_write_notice';
$select[] = 'g4_write_poll';
$select[] = 'g4_write_qna';
$select[] = 'g4_write_skin';
$select[] = 'g4_write_talk';
$select[] = 'g4_write_temp';
$select[] = 'g4_write_temppds';
$select[] = 'g4_write_test';
$select[] = 'g4_write_tiptech';
$select[]='g4_write_varios';
$ all = false; //确实写一个完整的插入语句
$ drop = true; //正确包含Drop Table语法
mysql_connect($ mysql_host,$ mysql_user,$ mysql_pass)|| DIE(“无法连接到数据库。”);
mysql_select_db($ mysql_db)|| DIE(“ DB访问失败”);
功能BAK_GETTABLENAME($ db)
{
$结果[0] = mysql_list_tables($db);
$result[1] = mysql_num_rows($result[0]);
return $result;
}
function bak_getFields($table)
{
global $all;
$result = mysql_query("show fields from $table");
$i = 0;
while($keys = mysql_fetch_array($result))
{
if(!$i) $defaultOrder = $keys[Field];
if($keys[Key] == 'PRI')
{
$orderby = $keys[Field];
break;
}
$i++;
}
if(!$orderby) $orderby = $defaultOrder;
$result = mysql_query("select * from $table order by $orderby");
$nums = mysql_num_fields($result);
if($all == true)
{
for($i=0;$i<$nums;$i++)
{
$fields[] = mysql_field_name($result,$i);
}
$fields = "(".implode(",",$fields).") ";
}
while($rows = mysql_fetch_row($result))
{
for($i=0;$i<$nums;$i++)
{
$temp = $rows[$i];
$temp = str_replace("'","''", $temp);
$temp = str_replace("","\", $temp);
$temp = str_replace("n",'n', $temp);
$temp = str_replace("r",'r', $temp);
$temp = iconv('CP949', 'UTF-8', $temp);
$insertValues[$i] = $temp;
}
$return .= "INSERT INTO $table ".$fields."values ('".implode("','",$insertValues)."');n";
}
return $return;
}
$tables = bak_getTableNames($mysql_db);
if($tables[1] > 0)
{
$ backText ='
# MysqlDump
#主机:“。$ mysql_host。”
#处理的时间:“ .date('Y Y Yater Jilh IP是)。”
#服务器版本:“ .mysql_get_server_info()。”
#数据库:`'。$ mysql_db。”''
#————————————————————— nnnnnn”;
while($rows = mysql_fetch_row($tables[0]))
{
$chk = false;
for($i=0;$i
Leave a Reply