frenzy01
หัวหน้าแก๊งเสียว
พลังน้ำใจ: 234
ออฟไลน์
กระทู้: 1,402
|
|
« เมื่อ: 24 กันยายน 2011, 10:38:50 » |
|
|
|
|
บันทึกการเข้า
|
|
|
|
aek26
สมุนแก๊งเสียว
พลังน้ำใจ: 68
ออฟไลน์
กระทู้: 572
|
|
« ตอบ #1 เมื่อ: 24 กันยายน 2011, 10:47:34 » |
|
ต้องบันทึกลง db มีอันนี้เปล่า $host = 'localhost'; $dbUser = 'xxxxxx'; $dbPass = 'xxxxxxxxx'; $dbName='xxxxxxxxxxx'; define("PATH", " http://localhost "); define("FULL_PATH", "C:/AppServ/www"); $connection = mysql_connect($host, $dbUser, $dbPass); mysql_select_db($dbName, $connection); mysql_query("SET NAMES UTF8");
|
|
|
บันทึกการเข้า
|
|
|
|
frenzy01
หัวหน้าแก๊งเสียว
พลังน้ำใจ: 234
ออฟไลน์
กระทู้: 1,402
|
|
« ตอบ #2 เมื่อ: 24 กันยายน 2011, 10:51:12 » |
|
ใน DB ก็แสดงเป็นภาษาไทยปกตินะครับ แต่ดึงมาโชว์เป็นภาษาอะไรก้ไม่รู้
|
|
|
บันทึกการเข้า
|
|
|
|
Kusumoto
สมุนแก๊งเสียว
พลังน้ำใจ: 42
ออฟไลน์
กระทู้: 552
|
|
« ตอบ #3 เมื่อ: 24 กันยายน 2011, 11:15:23 » |
|
แล้วเซต contect เข้ารหัสแบบไหนอ่ะ UTF-8 หรือ TIS620
|
|
« แก้ไขครั้งสุดท้าย: 24 กันยายน 2011, 11:16:42 โดย Kusumoto »
|
บันทึกการเข้า
|
|
|
|
beg
หัวหน้าแก๊งเสียว
พลังน้ำใจ: 149
ออฟไลน์
กระทู้: 1,445
|
|
« ตอบ #4 เมื่อ: 24 กันยายน 2011, 11:20:43 » |
|
ตามนี้ mysql_query("SET NAMES UTF8"); แล้วตรวจ encode ของไฟล์เว็บว่าเป็น UTF-8 หรือเปล่า เวลาเซฟไฟล์ต้องเซฟแบบ unicode หรือ utf-8 ด้วย
|
|
|
บันทึกการเข้า
|
|
|
|
Extra Cash
สมุนแก๊งเสียว
พลังน้ำใจ: 268
ออฟไลน์
กระทู้: 631
|
|
« ตอบ #5 เมื่อ: 24 กันยายน 2011, 11:21:23 » |
|
ลองใช้ notepad เปิดไฟล์ php แล้วกด save as เลือก Encoding เป็น UTF-8 แล้วกด Save ครับ
|
|
|
บันทึกการเข้า
|
|
|
|
kamjam
Verified Seller
หัวหน้าแก๊งเสียว
พลังน้ำใจ: 160
ออฟไลน์
กระทู้: 2,278
|
|
« ตอบ #6 เมื่อ: 24 กันยายน 2011, 11:42:06 » |
|
ดึงมาจากฐานข้อมูลหรือป่าว
ก่อนเก็บและแสดงใส่ แทก นี้ด้วย จะชัวร์กว่า <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
|
|
บันทึกการเข้า
|
|
|
|
LifeGood
สมุนแก๊งเสียว
พลังน้ำใจ: 45
ออฟไลน์
กระทู้: 574
|
|
« ตอบ #7 เมื่อ: 24 กันยายน 2011, 11:44:45 » |
|
ตรวจสอบ 4 อย่าง
1. db connect เพิ่ม mysql_query("SET NAMES UTF8"); รึยัง 2. ในดาต้าเบสมีการเรียงลำดับ(Collation) เป็น utf8_general_ci หรือไม่ 3. file encoding ตอน save เป็น utf-8 รึเปล่า 4. header ของเว็บเป็น charset=UTF-8 หรือไม่
ตรวจสอบและแก้ไขทั้ง 4 อย่างให้เรียบร้อยก็จะไม่เจอกับคำว่าภาษาต่างดาวอีกต่อไปครับ
|
|
|
บันทึกการเข้า
|
รับงาน PHP Programming ฟรีแลนซ์ จากโปรแกรมเมอร์ประสบการณ์กว่า 8 ปี ชำนาญเฟรมเวิร์ค CI ปรับแต่งได้ทุก CMS รับทั้งงานเล็กและงานใหญ่ในราคาเพื่อนฝูง รับทีละงาน ไม่พอกหางหมู เสร็จตรงเวลาแน่นอน แจ้งความคืบหน้าและอัพเดทความคืบหน้าของงานทุก 3 วัน สนใจ PM มาครับ!!!
|
|
|
frenzy01
หัวหน้าแก๊งเสียว
พลังน้ำใจ: 234
ออฟไลน์
กระทู้: 1,402
|
|
« ตอบ #8 เมื่อ: 24 กันยายน 2011, 12:53:46 » |
|
<?php if(isset($_REQUEST['action'])) { $sql = "select * from success "; $result = mysql_query($sql); $group = mysql_fetch_object($result); } ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en"> <head> <meta http-equiv="Content-Type" content="text/html; charset=windows-874" /> <link href="../css/main.css" type=text/css rel=stylesheet> <style type="text/css"> <!-- body,td,th { font-family: Arial, Helvetica, sans-serif; } h1,h2,h3,h4,h5,h6 { font-family: Arial, Helvetica, sans-serif; } --> </style></head> <body> <div id="content"> <table width="100%" align="center" cellspacing="1" class="admintable"> <tr> <td height="30" colspan="8" align="right" ><input type="button" class="button" name="button" id="button" value="ค้นหา" onclick="window.location='admin_index.php?option=search'"/></td> </tr> <tr> <td width="4%" align="center" class="key">ที่</td> <td width="27%" align="center" class="key">ชื่อ - สกุล </td> <td width="51%" align="center" class="key">ชื่อผลงาน</td> <td width="18%" align="center" class="key">ปีที่ได้รับ</td> </tr> <?php $count = 0; $sql = "select * from success ORDER BY po_id DESC"; //echo $sql; $result = mysql_query($sql); while($users = mysql_fetch_object($result)) { $count++; ($count % 2 != 0) ? $bgcolor = "#FFFFFF" : $bgcolor = "#F6F6F6"; ?> <tr> <td width="4%" align="center" valign="top" bgcolor="<?= $bgcolor ?>"><?= $count ?></td> <td align="left" valign="top" bgcolor="<?= $bgcolor ?>"><?php $users->po_id ?> <? $sql3 = "select * from pople where po_id='$users->po_id' "; //echo $sql; $result3 = mysql_query($sql3); while($acct = mysql_fetch_object($result3)) { ?><?= $acct->po_name ?> <?= $acct->po_lastname ?> <? }?> </td> <td align="left" valign="top" bgcolor="<?= $bgcolor ?>"><?=$users->success_name ?></td> <td align="center" valign="top" bgcolor="<?= $bgcolor ?>"><?=$users->success_year ?> </td> </tr> <? } ($count % 2 == 0) ? $bgcolor = "#FFFFFF" : $bgcolor = "#F6F6F6"; ?> </table> </div> </body> </html>
ตามนี้ครับ แก้ตรงไหน
|
|
|
บันทึกการเข้า
|
|
|
|
aaaaaa1
ก๊วนเสียว
พลังน้ำใจ: 17
ออฟไลน์
กระทู้: 331
|
|
« ตอบ #9 เมื่อ: 24 กันยายน 2011, 12:57:35 » |
|
http://th.php.net/manual/en/function.iconv.php ลองดูคำสั่งนี้ครับ
|
|
|
บันทึกการเข้า
|
|
|
|
Extra Cash
สมุนแก๊งเสียว
พลังน้ำใจ: 268
ออฟไลน์
กระทู้: 631
|
|
« ตอบ #10 เมื่อ: 24 กันยายน 2011, 13:05:54 » |
|
<meta http-equiv="Content-Type" content="text/html; charset=windows-874" /> แก้เป็น <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> แล้ว save as, encoding เป็น UTF-8 ตามที่บอกด้านบน ลองหรือยังครับ
|
|
|
บันทึกการเข้า
|
|
|
|
seowizard
หัวหน้าแก๊งเสียว
พลังน้ำใจ: 102
ออฟไลน์
กระทู้: 1,119
|
|
« ตอบ #11 เมื่อ: 24 กันยายน 2011, 19:07:00 » |
|
น่าจะไม่เหลือละครับ คำตอบแต่ละท่านรวม ๆกัน เรียกว่าครอบคลุมทุกจุดกันเลยทีเดียว
|
|
|
บันทึกการเข้า
|
|
|
|
ad0010
คนรักเสียว
พลังน้ำใจ: 15
ออฟไลน์
กระทู้: 165
|
|
« ตอบ #12 เมื่อ: 27 กันยายน 2011, 16:32:48 » |
|
ผมก็ว่า น่าจะเป็นตอน บันทึกข้อมูลไม่ได้เซ็ต mysql_query("set NAMES tis620 "); ครับ เป็นตอนใช้คำสั่ง บันทึกลงฐานข้อมูลนะครับ ไม่น่าจะใช่ตอนอ่านข้อมูลครับ
|
|
|
บันทึกการเข้า
|
|
|
|
|