听前辈说要在php页面加
header("Content-type: text/html; charset=utf-8");
这个,我加了还是乱码噢 ,
就这俩个php页面, 还有俩个页面是分页类来的。。business_form.php
<?php
header("Content-type: text/html; charset=utf-8");
include 'comm.php';
if(isset($_POST['qq'])){
$qq = $_POST['qq'];
$selling_price = $_POST['selling_price'];
$original = $_POST['original'];
$expires = $_POST['expires'];
business_table.php
<?php
include 'paging.php';
$con =mysql_connect("localhost","root","123456");
mysql_select_db("business",$con);
$result = mysql_paging_query("SELECT * FROM business_table", 5);
echo "<table border='1' height='30' width='480' style=text-align:center>
<tr>
<th>QQ</th>
<th>价格</th>
<th>原价</th>
<th>到期时间</th><th>服务</th>
</tr>";
while($row=mysql_fetch_array($result)){
echo "<tr>";
echo "<td width='120' height='30' >" . $row['qq'] . "</td>";
echo "<td width='120' height='30'>" . $row['selling_price'] . "</td>";
echo "<td width='120' height='30'>" . $row['original'] . "</td>";
echo "<td width='120' height='30'>" . $row['expires'] . "</td>";
echo "<td width='120' height='30'>" . $row['diamond']."</td>";
echo "</tr>";
}
echo "</table>";
mysql_paging_bar();//显示分页条 下面也来一个
mysql_close($con);?>
header("Content-type: text/html; charset=utf-8");
这个,我加了还是乱码噢 ,
就这俩个php页面, 还有俩个页面是分页类来的。。business_form.php
<?php
header("Content-type: text/html; charset=utf-8");
include 'comm.php';
if(isset($_POST['qq'])){
$qq = $_POST['qq'];
$selling_price = $_POST['selling_price'];
$original = $_POST['original'];
$expires = $_POST['expires'];
business_table.php
<?php
include 'paging.php';
$con =mysql_connect("localhost","root","123456");
mysql_select_db("business",$con);
$result = mysql_paging_query("SELECT * FROM business_table", 5);
echo "<table border='1' height='30' width='480' style=text-align:center>
<tr>
<th>QQ</th>
<th>价格</th>
<th>原价</th>
<th>到期时间</th><th>服务</th>
</tr>";
while($row=mysql_fetch_array($result)){
echo "<tr>";
echo "<td width='120' height='30' >" . $row['qq'] . "</td>";
echo "<td width='120' height='30'>" . $row['selling_price'] . "</td>";
echo "<td width='120' height='30'>" . $row['original'] . "</td>";
echo "<td width='120' height='30'>" . $row['expires'] . "</td>";
echo "<td width='120' height='30'>" . $row['diamond']."</td>";
echo "</tr>";
}
echo "</table>";
mysql_paging_bar();//显示分页条 下面也来一个
mysql_close($con);?>
倒是 business_table.php 要输出数据,所以有必要声明编码。如果还有乱码的话,尝试 在每个 mysql_connect()后加一句代码
mysql_query("set names utf8"); 声明现在插入内容所使用的字符集,以及期望返回结果的字符集
如果不确定是什么文件,那么每个文件你都加上 header("Content-type: text/html; charset=utf-8"); 当然图片类的就别加了
数据库链接来个1楼的 SET NAMES 'UTF8'然后...