 |
|
ใน MSSQL Server Collation : Thai_CI_AS เวลากรอกภาษาไทยไม่เเสดงผลลัพธ์ เเก้ไขอย่างไรดีครับ


/*** index.php**/
<!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>
<meta http-equiv=Content-Type content="text/html; charset=tis-620">
<title>auto complete</title>
<link rel="stylesheet" type="text/css" href="reset.css">
<link rel="stylesheet" type="text/css" href="test.css">
<link rel="stylesheet" type="text/css" href="autocomplete/jquery.autocomplete.css" />
<script type="text/javascript" src="autocomplete/jquery.js"></script>
<script type="text/javascript" src="autocomplete/jquery.autocomplete.js"></script>
<script>
$(document).ready(function(){
$("#dept").autocomplete("autocomplete.php", {
selectFirst: true
});
});
</script>
<script type="text/javascript">
function clearValue(obj,text){
if ( obj.value == text ) obj.value = '';
}
function checkValue(obj,text){
if ( obj.value == '' ) obj.value = text;
}
</script>
</head>
<body>
<table class="text_addjob" width="1000" border="0" cellpadding="0" cellspacing="7" bgcolor="white" >
<tr>
<td style="text-align:right"><font color="blue">แผนก : </font></td>
<td width="65%"><input class="inputDepartmentname" type="text" name="dept" id="dept" value="กรอกชื่อเเผนก" onblur="checkValue(this,'กรอกชื่อเเผนก')" onfocus="clearValue(this,'กรอกชื่อเเผนก')" />
</td>
</tr>
</table>
</body>
</html>
/***** auto complete.php **/
ทดลองรัน ไฟล์ auto complete.php ก็เเสดงภาษาไทยได้ปกติ
<!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>
<meta http-equiv=Content-Type content="text/html; charset=tis-620">
<title>Auto complete</title>
</head>
<body>
<?
$q=$_GET['q'];
$my_data=str_replace('\'', '\'\'', $q); /* ใส่เครื่องหมาย \ เข้าไปหน้า special characters */
$objConnect=mssql_connect("localhost","admin","sa2008") or die("can't connect to MS SQL Server Error: " . mssql_get_last_message());
mssql_select_db("DBfixasst_gp",$objConnect);
$sql="SELECT [desc] FROM gldept WHERE [desc] LIKE '%$my_data%' ORDER BY [desc]";
$result = mssql_query($sql) or die ("Error Query [".$sql."]");
if($result)
{
while($row=mssql_fetch_array($result))
{
echo $row["desc"]."\n";
}
}
?>
</body>
</html>
Tag : PHP, Ms SQL Server 2008, jQuery
|
ประวัติการแก้ไข 2014-08-20 18:37:20
|
 |
 |
 |
 |
Date :
2014-08-20 18:36:24 |
By :
junior_dev |
View :
1035 |
Reply :
3 |
|
 |
 |
 |
 |
|
|
|
 |