|
|
|
ช่วยเรื่องการแสดงภาษาทีครับ อยากให้แสดง UTF-8 ครับ ตอนนี้มันแสดงเพียงบางส่วน |
|
|
|
|
|
|
|
Code (PHP)
<html>
<head>
<title>ThaiCreate.Com PHP & UTF-8</title>
<meta http-equiv=Content-Type content="text/html; charset=utf-8">
</head>
<body>
<?
/*** Connect ***/
$objConnect = mysql_connect("localhost","root","root") or die("Error Connect to Database");
$objDB = mysql_select_db("mydatabase");
mysql_query("SET NAMES UTF8");
/*
// Or //
mysql_query("SET character_set_results=utf8");
mysql_query("SET character_set_client=utf8");
mysql_query("SET character_set_connection=utf8");
*/
/*** Add Record ***/
if($_GET["Action"]=="Save")
{
$strSQL = "INSERT INTO mydata_utf8 (NAME,SURNAME) VALUES ('".$_POST["txtName"]."','".$_POST["txtSurname"]."')";
mysql_query($strSQL);
}
/*** List Record ***/
$strSQL = "SELECT * FROM mydata_utf8";
$objQuery = mysql_query($strSQL) or die ("Error Query [".$strSQL."]");
?>
<table width="498" border="1">
<tr>
<th width="87"> <div align="center">UID </div></th>
<th width="145"> <div align="center">NAME </div></th>
<th width="244"> <div align="center">SURNAME </div></th>
</tr>
<?
while($objResult = mysql_fetch_array($objQuery))
{
?>
<tr>
<td><div align="center"><?=$objResult["UID"];?></div></td>
<td><?=$objResult["NAME"];?></td>
<td><?=$objResult["SURNAME"];?></td>
</tr>
<?
}
?>
<form name="frmMain" method="post" action="?Action=Save">
<tr>
<td>
</td>
<td><input name="txtName" type="text" id="txtName"></td>
<td><input name="txtSurname" type="text" id="txtSurname">
<input name="btnSubmit" type="submit" id="btnSubmit" value="Submit"></td>
</tr>
</form>
</table>
<?
mysql_close($objConnect);
?>
</body>
</html>
Go to : แก้ปัญหาภาษาไทย php กับ MySQL (TIS-620 กับ UTF-8)
|
|
|
|
|
Date :
2012-06-17 10:31:52 |
By :
mr.win |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ขอบคุณครับ
|
|
|
|
|
Date :
2012-06-18 00:30:23 |
By :
preacher |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Load balance : Server 03
|