|
 |
|
รบกวนช่วยดูโค้ให้หน่อยได้มั้ยคะ พอดึงจากฐานข้อมูลมา มันขึ้นภาษา ????? อ่ะค่ะ แล้วพอเราแก้ไขแล้วทำยังไงให้พอมันเข้าฐานแล้วไม่เป็นภาษาต่างดาวด้วยค่ะ |
|
 |
|
|
 |
 |
|

อันนี้โค้ดค่ะ
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<body>
<form action="EditRecordSave.php?StudentID=<?php echo $_GET["StudentID"];?>" name="frmEdit" method="post">
<?php
$objConnect = mysql_connect("localhost","root","1234") or die("Error Connect to Database");
$objDB = mysql_select_db("sieccheck");
$strSQL = "SELECT * FROM member WHERE StudentID = '".$_GET["StudentID"]."' ";
$objQuery = mysql_query($strSQL);
$objResult = mysql_fetch_array($objQuery);
if(!$objResult)
{
echo "Not found StudentID=".$_GET["StudentID"];
}
else
{
?>
<table width="738" border="1">
<tr>
<th width="112"> <div align="center">StudentID </div></th>
<th width="123"> <div align="center">IDcardcode </div></th>
<th width="133"> <div align="center">Name </div></th>
<th width="131"> <div align="center">Lastname </div></th>
<th width="128"> <div align="center">Department </div></th>
<th width="71"> <div align="center">Grade </div></th>
</tr>
<tr>
<td><div align="center"><input type="text" name="txtStudentID" size="10" value="<?php echo $objResult["StudentID"];?>"></div></td>
<td><input type="text" name="txtIDcardcode" size="20" value="<?php echo $objResult["IDcardcode"];?>"></td>
<td><input type="text" name="txtName" size="10" value="<?php echo $objResult["Name"];?>"></td>
<td><div align="center"><input type="text" name="txtLastname" size="6" value="<?php echo $objResult["Lastname"];?>"></div></td>
<td align="right"><input type="text" name="txtDepartment" size="15" value="<?php echo $objResult["Department"];?>"></td>
<td align="right"><input type="text" name="txtGrade" size="5" value="<?php echo $objResult["Grade"];?>"></td>
</tr>
</table>
<input type="submit" name="submit" value="submit">
<?php
}
mysql_close($objConnect);
?>
</form>
</body>
</html>
ส่วนอันนี้พอแก้ไขแล้ว ข้อมูลเข้าฐาน แต่ในฐานดันขึ้นภาษาต่างดาวอ่ะค่ะ ทำยังไงให้มันเป็นภาษาไทยคะ

โค้ดตัวเดียวกัน แล้วอันนี้เป็นอีกโค้ดค่ะ เป็นโค้ด Save ค่ะ
<body>
<?php
$objConnect = mysql_connect("localhost","root","1234") or die("Error Connect to Database");
$objDB = mysql_select_db("sieccheck");
$strSQL = "UPDATE member SET ";
$strSQL .="StudentID = '".$_POST["txtStudentID"]."' ";
$strSQL .=",IDcardcode = '".$_POST["txtIDcardcode"]."' ";
$strSQL .=",Name = '".$_POST["txtName"]."' ";
$strSQL .=",Lastname = '".$_POST["txtLastname"]."' ";
$strSQL .=",Department = '".$_POST["txtDepartment"]."' ";
$strSQL .=",Grade = '".$_POST["txtGrade"]."' ";
$strSQL .="WHERE StudentID = '".$_GET["StudentID"]."' ";
$objQuery = mysql_query($strSQL);
if($objQuery)
{
echo "Save Done.";
}
else
{
echo "Error Save [".$strSQL."]";
}
mysql_close($objConnect);
?>
<br>
<a href="admin_page.php">Back
</a>
</body>
</html>
Tag : PHP, MySQL, JavaScript, Appserv

|
|
 |
 |
 |
 |
Date :
2021-03-10 15:05:00 |
By :
dearza44 |
View :
631 |
Reply :
3 |
|
 |
 |
 |
 |
|
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
ลองดู ได้/ไม่ได้ พระเจ้าคงไม่ว่ากระไรหรอกมั้ง
EditRecordForm.php ให้คุณ Save As UTF8-BOM
ดังรูปภาพด้านล่าง (ผมก็งงงง อยู่เหมือนกัน Copy file มาจากจีน xxx.json)
ทำได้ทุกฯอย่าง แต่ตอนเอาขึ้น Server จริงทำงานไม่ได้
แสบสันต์จริงฯ

|
 |
 |
 |
 |
Date :
2021-03-11 10:40:26 |
By :
ผ่านมา |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
|
|
|

|
Load balance : Server 03
|