doufuxing8691
2015-03-28 20:17
浏览 147
已采纳

从MySQL获取中文字符

I am trying to display chinese characters that I have saved in MySQL database, which is saved under utf8_unicode_ci type. I have seen several solutions on the web, but nothing works.

Below is my connection file:

$conn = mysql_connect("localhost","root","password");
mysql_set_charset('utf8',$conn);
mysql_query("SET CHARACTER SET utf8 ");
mysql_select_db("database");

Below is my query:

mysql_query("SET character_set_results=utf8", $conn);

$sql = mysql_query("select * from webdata",$conn);

But it still shows ????. Any ideas?

图片转代码服务由CSDN问答提供 功能建议

我正在尝试显示我保存在MySQL数据库中的中文字符,该数据库以utf8_unicode_ci类型保存。 我在网上看到了几种解决方案,但没有任何效果。

下面是我的连接文件:

  $ conn = mysql_connect(“localhost”,“root”,“password”); \  nmysql_set_charset('utf8',$ conn); 
mysql_query(“SET CHARACTER SET utf8”); 
mysql_select_db(“database”); 
   
 
 

以下是我的查询 :

  mysql_query(“SET character_set_results = utf8”,$ conn); 
 
 $ sql = mysql_query(“select * from webdata”,$ conn); 
    
 
 

但它仍然显示????。 有什么想法吗?

  • 写回答
  • 好问题 提建议
  • 追加酬金
  • 关注问题
  • 邀请回答

3条回答 默认 最新

相关推荐 更多相似问题