 |
|
รบกวนสอบถามหน่อยครับพี่ ๆใช้ editor dreamweaverเขียนphp+mysql เวลาแสดงผลมันเป็น ???? ตอนสร้างฐานข้อมูล ผมลองเลือกให้เป็น utf8_unicode_ci และ utf8_general_ci ก้อไม่ได้ครับ ต้องแก้อย่างไรครับ
code แบบนี้ครับ
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>การอ่านข้อมูลจาก MySQL ลงตาราง</title>
<meta http-equiv="Content-Type" content="text/html; charset=tis-620">
</head>
<body>
<table width="500" border="1" cellpadding="2" cellspacing="0" bordercolor="#0066FF">
<tr bgcolor="#0066FF">
<td><div align="center"><font color="#FFFFFF" face="Tahoma, MS Sans Serif"><strong>รหัสนักศึกษา</strong></font></div></td>
<td><div align="center"><font color="#FFFFFF" face="Tahoma, MS Sans Serif"><strong>ชื่อ</strong></font></div></td>
<td><div align="center"><font color="#FFFFFF" face="Tahoma, MS Sans Serif"><strong>Email
</strong></font></div></td>
</tr>
<?php
$hostname = "localhost";
$username = "user";
$password = "xxxx";
$dbname = "school";
$conn = mysql_connect( $hostname, $username, $password );
if ( ! $conn )
die ( "ไม่สามารถติดต่อกับ MySQL ได้" );
mysql_select_db ( $dbname, $conn )
or die ( "ไม่สามารถเลือกฐานข้อมูล school ได้" );
$sqltxt = "SELECT * FROM student";
$result = mysql_query ( $sqltxt, $conn );
while ( $rs = mysql_fetch_array ( $result ) )
{
?>
<tr>
<td><font size="2" face="Tahoma, MS Sans Serif"><?php echo $rs["stdid"] ?></font></td>
<td><font size="2" face="Tahoma, MS Sans Serif"><?php echo $rs["stdname"] ?></font></td>
<td><font size="2" face="Tahoma, MS Sans Serif"><?php echo $rs["email"] ?></font></td>
</tr>
<?php
}
mysql_close ( $conn );
?>
</table>
</body>
</html>

Tag : PHP, MySQL, HTML/CSS
|
|
 |
 |
 |
 |
Date :
2010-11-08 10:50:34 |
By :
noizeless |
View :
1768 |
Reply :
5 |
|
 |
 |
 |
 |
|
|
|
 |