分类:
2008-05-29 10:14:56
php
$conn = mysql_connect("localhost","root",""); php程序员站
mysql_query("set names 'gbk'");//这就是指定数据库字符集,一般放在连接数据库后面就系了
mysql_select_db("test");
$sql = "select * from mysqlcode";
$result = mysql_query($sql,$conn);
?>
<head> php程序员站
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>mysql 字符编码title>
head>
<body>
<table width="300" height="32" border="1" align="center" cellpadding="0" cellspacing="0">
php程序员之家
<tr>
<td width="71" align="center">idtd>
<td width="229" align="center">内容td>
phperz.com
tr>
php while($row = mysql_fetch_assoc($result)){
echo "
".$row['id']."
".$row['content']."
phperz.com
";
}?>
table>
body>
html>
php mysql_free_result($result);?>