复制代码 代码如下:
Create TABLE `table` (
`id` INT( 10 ) NOT NULL ,
`name` VARCHAR( 50 ) CHARACTER SET utf8 COLLATE utf8_general_ci NOT NULL ,
INDEX ( `g_id` )
) ENGINE = innodb CHARACTER SET utf8 COLLATE utf8_general_ci;
复制代码 代码如下:
<?php
// Select DB And Set Link Use UTF8
function _select_db_utf()
{
mysql_select_db($this->db_name, $this->db_link);
// init character
mysql_query("SET NAMES utf8", $this->db_link);
mysql_query("SET CHARACTER SET utf8", $this->db_link);
mysql_query("SET COLLATION_CONNECTION='utf8_general_ci'", $this->db_link);
return true;
}
// Select DB And Set Link Use GBK
function _select_db_gb()
{
mysql_select_db($this->db_name, $this->db_link);
// init character
mysql_query("SET NAMES gbk", $this->db_link);
mysql_query("SET CHARACTER SET gbk", $this->db_link);
mysql_query("SET COLLATION_CONNECTION='gbk_chinese_ci'", $this->db_link);
return true;
}
?>
新闻热点
疑难解答