php读取mysql中文乱码
2013-11-19 16:35
232 查看
连接mysql的文件:
网站页面的编码:
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
mysql用utf8_unicode_ci。
保证了三者之间的统一,就不会有乱码了。
<?php /***************************** *数据库连接 *****************************/ $conn = @mysql_connect("localhost","root","123abcd"); if (!$conn){ exit("连接数据库失败:" . mysql_error()); } mysql_select_db("location", $conn); //字符转换,读库 mysql_query("set character set 'utf8'"); //写库 mysql_query("set names 'utf8'"); ?>
网站页面的编码:
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
mysql用utf8_unicode_ci。
保证了三者之间的统一,就不会有乱码了。
相关文章推荐
- php echo输出中文,读取MYSQL数据 echo 输出中文乱码
- PHP读取MySQL中文数据乱码[转载]
- PHP读取MySQL中文乱码
- mac 下的 xampp用php读取mysql数据 中文字符出现乱码
- php读取mysql中文数据出现乱码的解决方法
- Windows下php页面读取 mysql"中文数据"出现乱码的解决方法
- php读取mysql中文数据出现乱码的解决方法
- PHP 从数据库Mysql中读取数据生成excel(解决乱码问题,解决中文变问号问题)
- php读取mysql中文数据出现乱码的解决方法
- php读取mysql中文数据出现乱码
- PHP读取MySQL显示中文乱码
- PHP 从数据库Mysql中读取数据生成excel(解决乱码问题,解决中文变问号问题)
- R 从mysql读取数据中文乱码的解决方法
- PHP+MySQL中文乱码问题
- php读取数据库中文乱码解决方案之一
- php写入mysql中文乱码
- php和mysql交互过程中的中文乱码问题
- JS读取PHP中设置的中文cookie时出现乱码的解决方法
- php读取mysql乱码解决办法
- php和mysql中uft-8中文编码乱码的几种解决办法