ในกรณีรันหน้าเวปในเครื่องแล้วใช้งานได้ แต่พออัพโหลดขึ้น host แล้ว error แบบนี้
'c:\mysql\share\charsets\?.conf' not found (Errcode: 2)
Character set '#18' is not a compiled character set and is not specified in the 'c:\mysql\share\charsets\Index' file
อันนี้เป็น bug ของ mysql4 สำหรับ function mysql_connect ซึ่งถูกเรียกใช้ ใน body tag ครับ
วิธีแก้ไขคือ นำ function mysql_connect() ไปไว้บนสุดของ file .php นั้นๆ ที่ได้ถูกเรียกใช้ครับ
ยกตัวอย่าง
connect.php มี mysql_connect() function อยู่
ไฟล์ที่เรียก database ให้แก้ตามนี้ครับ
<?php
include ‘connect.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=windows-874" />
<title>Untitled Document</title>
</head>
<body>
<?php code ?>
</body>
</html>
หรือ ในกรณีที่ใช้ session
<?php
session_start();
include ‘connect.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=windows-874" />
<title>Untitled Document</title>
</head>
<body>
<?php code ?>
</body>
</html>