Search This Blog

Friday, May 14, 2010

mysql php support chinese

$host="localhost";
$usr="xxxxx";
$pwd="xxxxx";
$db="xxxxxx";
$link = mysql_connect($host, $usr, $pwd);

mysql_select_db($db);

mysql_query('SET NAMES "gb2312"');

if( mysql_error() ) { print "Database ERROR: " . mysql_error(); }

$query = "INSERT INTO ch VALUES ('034',convert('浏览器' using gb2312))";
 
mysql_query($query);

if (mysql_error()) { print "Database ERROR: " . mysql_error(); }


$query="SELECT * FROM ch";
$result=mysql_query($query);

while($row = mysql_fetch_array($result))
{
echo $row['ucs2'] . " || " . $row['gb2312'];
echo "
";
}

?>





php-mbstring

 1002  yum install php-mbstring
 1003  httpd -k restart
 1004  /etc/init.d/httpd -k restart
 1005  /etc/init.d/httpd -k stop
 1006  /etc/init.d/httpd stop
 1007  /etc/init.d/httpd start

ubuntu open iptables mysql port

 121  iptables -A INPUT -s x.x.x.x -p tcp --dport 3306 -j ACCEPT
  122  iptables -L
  123  iptables -A INPUT -j REJECT
  118  iptables -D INPUT 5

mysql add chinese support

mysql> alter table compounds add CNameCN varchar(255) CHARACTER SET gb2312 after CName;