如何解决php中文字符乱码,中文字符入库乱码的问题
时间:2021-07-01 10:21:17
帮助过:29人阅读
- /*
- @中文字符入库乱码的解决方法
- @bbs.it-home.org
- */
- include_once("conn.php");
- include_once("include.php");
- mysql_query("set names 'gbk'")or die("设置字符库失败\n");
- mysql_select_db($db)or die("连接数据库失败!\n");
- $exec = "select * from $table";
- //echo $exec;
- $result = mysql_query($exec,$conn)or die("查询数据库失败\n");
- echo "
";- for($cout=0;$cout{
- $city = mysql_result($result,$cout,city);
- $name = mysql_result($result,$cout,name);
- $phone = mysql_result($result,$cout,phone);
- echo "
";- echo "city: $city";
- echo "name: $name";
- echo "phone: $phone";
- echo "
"; - }
- echo "
"; - ?>
|