|
 |
|
ยังแก้ไม่ได้ครับ!!! ช่วยดูcode หน่อยครับว่าทำไม select ข้อมูลจาก DB แล้วเป็นเครื่องหมายคำถามทั้งที่ใส่codeกำหนดชนิดเป็น utf-8 (updat 16:15) |
|
 |
|
|
 |
 |
|
ลองเปลี่ยนจาก UTF-8 เป็น TIS-620
|
 |
 |
 |
 |
Date :
2010-09-23 09:17:34 |
By :
pong_757 |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
ทุกอย่างเป็น uft-8 โดยสมบูรณ์แล้วหรือไม่ database, field ,file php ,encode type
|
 |
 |
 |
 |
Date :
2010-09-23 09:21:55 |
By :
narubet |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
Database เป็น utf8_unicode_ci ทั้งหมดแล้วครับ
file php ,encode type ดูตรงใหนครับ
sql บังครับให้ดึงข้อมูลออกมาเป็น utf8 โดยใส่
mysql_query("SET NAMES 'utf-8'"); กับ
mysql_query("SET character_set_results='utf-8'");
ไว้แล้วครับ
แต่เวลา login ผ่านมันขึ้น ???? ???????????? ครับ
|
 |
 |
 |
 |
Date :
2010-09-23 09:36:16 |
By :
ziix |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
mysql_query("SET NAMES 'utf-8'"); กับ
mysql_query("SET character_set_results='utf-8'");
ลองเปลี่ยนเป็น
mysql_query("SET NAMES 'tis-620'"); กับ
mysql_query("SET character_set_results='tis-620'");
ยังไม่ได้ครับ
แต่ไม่ได้เปลี่ยนที่ DB นะครับ
|
 |
 |
 |
 |
Date :
2010-09-23 09:40:32 |
By :
ziix |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
file php ,encode type ดูตรงใหนครับ
เขียนกับอะไร ถ้า editplus ก็ตอน save จะมีช่อง encoding เลือก utf-8
server apache config default charset='utf-8' หรือไม่
ด้าบนไฟล์แต่ละหน้า <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
Code (PHP)
DB_conf.php
<?
//------------ส่วนการเปิด Connection ในการติดต่อกับ MySQL ----------------
$hostname = "localhost";
$username = "root";
$password = "tctadmin";
$dbname = "ts_send_mail";
$conn = mysql_connect( $hostname, $username, $password );
if ( ! $conn )
die ( "ไม่สามารถติดต่อกับ MySQL ได้" );
//----------จบ ส่วนการเปิด Connection ในการติดต่อกับ MySQL ---------------
//----------ส่วนการเลือกฐานข้อมูล school --------------------------------------
mysql_select_db ( $dbname, $conn )
or die ( "can't select hrga" );
//----------จบส่วนการเลือกฐานข้อมูล school -------------------------------------
//ใส่ตรงนี้เลยบังคับแต่เริ่มคอนเน็กเลย
mysql_query("SET NAMES 'utf-8'"); กับ
mysql_query("SET character_set_results='utf-8'");
?>
|
 |
 |
 |
 |
Date :
2010-09-23 09:46:38 |
By :
narubet |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
ยังไม่ได้ครับ
*** check_login.php
Code (PHP)
<?
include("DB_Conf.php");
?>
<?
$user_login=$_REQUEST["user_id"];
$password_login=$_REQUEST["passwd"];
if ($user_login=="" or $password_login=="")
{
echo "<h3>ERROR : Please input user and password<h3>";
exit();
}
$select_user = "select * from user_detail where user_id='$user_login' and passwd='$password_login' ";
$result = mysql_db_query($dbname,$select_user);
mysql_query("SET NAMES 'UTF-8'");
mysql_query("SET character_set_results='UTF-8'");
$num=mysql_num_rows($result);
$user_detail=mysql_fetch_array($result);
//mysql_close();
if ($user_detail['user_status']=='0')
{
echo "<h3>ERROR : ???----??? <h3> ";
}
else
{
if (empty($num))
{
echo "<h3>ERROR : Check User and Password <h3> ";
}
else
{
session_start();
$_SESSION[sess_userid]=session_id();
$_SESSION[sess_user]=$user_login;
$_SESSION[sess_name]=$user_detail['name'];
$_SESSION[sess_status]=$user_detail['user_status'];
$_SESSION[sess_project]=$user_detail['email'];
$_SESSION[sess_group]=$user_detail['authen_email'];
$_SESSION[sess_familyname]=$user_detail['family_name'];
?>
<?
//เอาค่า echo ออกมาดู ตรงนี้ยังอ่านไม่ออกเลย
echo $_SESSION[sess_name]." ".$_SESSION[sess_familyname];
?>
<? }}?>
ส่วนของ connect DB
** DB_conf.php
Code (PHP)
<?
//------------ส่วนการเปิด Connection ในการติดต่อกับ MySQL ----------------
$hostname = "localhost";
$username = "root";
$password = "tctadmin";
$dbname = "ts_send_mail";
$conn = mysql_connect( $hostname, $username, $password );
if ( ! $conn )
die ( "ไม่สามารถติดต่อกับ MySQL ได้" );
//----------จบ ส่วนการเปิด Connection ในการติดต่อกับ MySQL ---------------
//----------ส่วนการเลือกฐานข้อมูล school --------------------------------------
mysql_select_db ( $dbname, $conn )
or die ( "can't select hrga" );
//----------จบส่วนการเลือกฐานข้อมูล school -------------------------------------
//ใส่ตรงนี้เลยบังคับแต่เริ่มคอนเน็กเลย
mysql_query("SET NAMES 'utf-8'");
mysql_query("SET character_set_results='utf-8'");
?>
รองใช้ editplus save เป็น แล้วครับ
ส่วน meta ไม่ได้ใช้ เพราะใช้แล้วชอบขึ้น error header already send
DB ทั้ง table เป็น utf-8 หมดแล้ว
รองดึงข้อมูลที่หน้าอื่นก็ยังอ่านไม่ได้ครับ เขียน select ข้อมูลใหม่ก็ไม่ได้
Code (PHP)
<?
$sql= "SELECT * FROM user_detail WHERE user_id = '$_SESSION[sess_user]' ";
$result_show = mysql_db_query($dbname,$sql);
$show = mysql_fetch_array($result_show)
?>
ช่วยด้วยครับๆๆๆๆๆ
|
ประวัติการแก้ไข 2010-09-23 12:40:33 2010-09-23 16:07:37
 |
 |
 |
 |
Date :
2010-09-23 11:20:10 |
By :
ziix |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
ลองดูตรงนี้ครับ

ถ้าไม่ได้อันนี้ความลับนะนี่
ตรงไฟล์ของคุณครับ ลองสร้าง tag <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> เอาไว้ส่วนไหนของหน้าก็ได้ครับ เสร็จแล้วก็ save หลังจากนั้น ปิดไฟล์นี้ไปแล้วก็เปิดขึ้นมาใหม่ เร็จแล้วลบ tag <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> ออก แล้วกด save อีกทีครับ แล้วลองทดสอบดูครับ
ถ้าไม่ได้อีกเดี๋ยวมาว่ากันอีกทีครับพี่น้อง   
|
 |
 |
 |
 |
Date :
2012-02-10 16:28:25 |
By :
slurpee55555 |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
|
|
|

|
Load balance : Server 00
|