Register Register Member Login Member Login Member Login Forgot Password ??
PHP , ASP , ASP.NET, VB.NET, C#, Java , jQuery , Android , iOS , Windows Phone
 

Registered : 109,038

HOME > PHP > PHP Forum > มีปัญหากับภาษาไทย ที่ดึงข้อมูลมาจาก MSSQL เวลาแสดงข้อมูลกลายเป็น ??????


[PHP] มีปัญหากับภาษาไทย ที่ดึงข้อมูลมาจาก MSSQL เวลาแสดงข้อมูลกลายเป็น ??????

 
Topic : 105315



โพสกระทู้ ( 316 )
บทความ ( 0 )



สถานะออฟไลน์



มีปัญหากับภาษาไทย ที่ดึงข้อมูลมาจาก MSSQL เวลาแสดงข้อมูลกลายเป็น ??????

ตัว SQL ตั้ง Collation=ไม่ได้ตั้งเป็น thai_CI_AS เพราะเป็น Server เดิม
ลองกำหนด => <meta http-equiv="content-type" content="text/html; charset=UTF-8" /> ก็ไม่ได้

แต่เครื่อง Server เก่าเคยแก้ได้แต่หาวิธีไม่เจอเป็นการแก้แบบไปโหลดไฟล์อะไรสักอย่างมาไว้ที่เครื่องแล้วก็แก้ php.ini นิดหน่อยก็แสดงข้อมูลได้ ตอนนี้ลงเครื่องใหม่ไม่รู้จะทำยังไงดี



Tag : PHP, Ms SQL Server 2005

Move To Hilight (Stock) 
Send To Friend.Bookmark.
Date : 2014-02-01 02:06:21 By : karurub View : 1201 Reply : 13
 

 

No. 1



โพสกระทู้ ( 74,059 )
บทความ ( 838 )

สมาชิกที่ใส่เสื้อไทยครีเอท

สถานะออฟไลน์
Twitter Facebook

Quote:
UTF-8


ใช้ TIS-620 ครับ หรือ Windows-874
แสดงความคิดเห็นโดยอ้างถึง ความคิดเห็นนี้
Date : 2014-02-01 06:03:15 By : mr.win
 

 

No. 2



โพสกระทู้ ( 316 )
บทความ ( 0 )



สถานะออฟไลน์


ลองเปลี่ยนทั้งสองอันก็ยังไม่ได้ครับ

error
แสดงความคิดเห็นโดยอ้างถึง ความคิดเห็นนี้
Date : 2014-02-01 10:18:26 By : karurub
 

 

No. 3



โพสกระทู้ ( 342 )
บทความ ( 2 )

สมาชิกที่ใส่เสื้อไทยครีเอท

สถานะออฟไลน์


ขอดูโค๊ดหน่อยครับ
แสดงความคิดเห็นโดยอ้างถึง ความคิดเห็นนี้
Date : 2014-02-01 11:30:12 By : weaned
 

 

No. 4



โพสกระทู้ ( 316 )
บทความ ( 0 )



สถานะออฟไลน์


Code (PHP)
01.<?
02.    session_start();
03.    if($_SESSION['U_username'] == "")
04.    {
05.        echo "Please Login!";
06.        echo "<META HTTP-EQUIV=refresh CONTENT=\"2; URL= login.php\">";
07.        exit();
08.    }
09.    if($_SESSION['U_type'] != "ADMIN" && $_SESSION['U_type'] != "MANAGER" && $_SESSION
10. 
11.['U_type'] != "USER")
12.    {
13.        echo "This page for User only!";
14.        echo "<META HTTP-EQUIV=refresh CONTENT=\"2; URL= login.php\">";
15.        exit();
16.    }
17.    mysql_connect("localhost","root","Abc@1234");
18.    mysql_select_db("crm");
19.    mysql_query("SET NAMES UTF8");
20. 
21.    $strSQL = "SELECT * FROM user WHERE U_username = '".$_SESSION['U_username']."' ";
22.    $objQuery = mysql_query($strSQL);
23.    $objResult = mysql_fetch_array($objQuery);
24.?>
25. 
26.<html>
27.<head>

แสดงความคิดเห็นโดยอ้างถึง ความคิดเห็นนี้
Date : 2014-02-01 13:10:04 By : karurub
 

 

No. 5



โพสกระทู้ ( 74,059 )
บทความ ( 838 )

สมาชิกที่ใส่เสื้อไทยครีเอท

สถานะออฟไลน์
Twitter Facebook

ข้อมูลใน Database เป็นภาษาไทยหรือเปล่าครับ
แสดงความคิดเห็นโดยอ้างถึง ความคิดเห็นนี้
Date : 2014-02-01 17:28:04 By : mr.win
 

 

No. 6



โพสกระทู้ ( 26 )
บทความ ( 0 )



สถานะออฟไลน์


Code (PHP)
01.<?php
02.    session_start();
03.    if($_SESSION['U_username'] == "")
04.    {
05.        echo "Please Login!";
06.        echo "<META HTTP-EQUIV=refresh CONTENT=\"2; URL= login.php\">";
07.        exit();
08.    }
09.    if($_SESSION['U_type'] != "ADMIN" && $_SESSION['U_type'] != "MANAGER" && $_SESSION
10. 
11.['U_type'] != "USER")
12.    {
13.        echo "This page for User only!";
14.        echo "<META HTTP-EQUIV=refresh CONTENT=\"2; URL= login.php\">";
15.        exit();
16.    }
17.    mysql_connect("localhost","root","Abc@1234");
18.    mysql_select_db("crm");
19.    mysql_query("SET character_set_results=tis620");
20.    mysql_query("SET character_set_client=tis620");
21.    mysql_query("SET character_set_connection=tis620");
22. 
23.    $strSQL = "SELECT * FROM user WHERE U_username = '".$_SESSION['U_username']."' ";
24.    $objQuery = mysql_query($strSQL);
25.    $objResult = mysql_fetch_array($objQuery);
26.?>



ประวัติการแก้ไข
2014-02-01 17:42:10
2014-02-01 17:42:49
2014-02-01 17:45:03
2014-02-01 17:45:43
2014-02-01 17:45:56
2014-02-01 17:51:42
แสดงความคิดเห็นโดยอ้างถึง ความคิดเห็นนี้
Date : 2014-02-01 17:41:03 By : bookbang
 

 

No. 7



โพสกระทู้ ( 316 )
บทความ ( 0 )



สถานะออฟไลน์


ตอบความคิดเห็นที่ : 5 เขียนโดย : mr.win เมื่อวันที่ 2014-02-01 17:28:04
รายละเอียดของการตอบ ::
ข้อมูลเป็นภาษาไทยครับ

แสดงความคิดเห็นโดยอ้างถึง ความคิดเห็นนี้
Date : 2014-02-01 20:30:42 By : karurub
 

 

No. 8



โพสกระทู้ ( 316 )
บทความ ( 0 )



สถานะออฟไลน์


ตอบความคิดเห็นที่ : 4 เขียนโดย : karurub เมื่อวันที่ 2014-02-01 13:10:04
รายละเอียดของการตอบ ::
... ในส่วนของ Mysql ไม่มีปัญหาครับ แต่ในส่วนที่ดึข้อมูลมาจาก Mssql มีปัญหาเรื่องภาษาไม่แสดงภาษาไทยครับ

แสดงความคิดเห็นโดยอ้างถึง ความคิดเห็นนี้
Date : 2014-02-01 20:32:34 By : karurub
 

 

No. 9



โพสกระทู้ ( 1,569 )
บทความ ( 2 )



สถานะออฟไลน์
Twitter Facebook Blogger

ต้องดูที่ Db แล้วล่ะครับว่า encoding เป็นอะไร
แสดงความคิดเห็นโดยอ้างถึง ความคิดเห็นนี้
Date : 2014-02-01 22:52:27 By : itpcc
 

 

No. 10



โพสกระทู้ ( 342 )
บทความ ( 2 )

สมาชิกที่ใส่เสื้อไทยครีเอท

สถานะออฟไลน์


Code (PHP)
01.<?php
02.    session_start();
03.        echo "<meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\">";
04.    if($_SESSION['U_username'] == "")
05.    {
06.        echo "Please Login!";
07.        echo "<META HTTP-EQUIV=refresh CONTENT=\"2; URL= login.php\">";
08.        exit();
09.    }
10.    if($_SESSION['U_type'] != "ADMIN" && $_SESSION['U_type'] != "MANAGER" && $_SESSION
11. 
12.['U_type'] != "USER")
13.    {
14.        echo "This page for User only!";
15.        echo "<META HTTP-EQUIV=refresh CONTENT=\"2; URL= login.php\">";
16.        exit();
17.    }
18.    mysql_connect("localhost","root","Abc@1234");
19.    mysql_select_db("crm");
20.    mysql_query("SET character_set_results=utf8");
21.        mysql_query("SET character_set_client=utf8");
22.        mysql_query("SET character_set_connection=utf8");
23. 
24.    $strSQL = "SELECT * FROM user WHERE U_username = '".$_SESSION['U_username']."' ";
25.    $objQuery = mysql_query($strSQL);
26.    $objResult = mysql_fetch_array($objQuery);
27.?>

แสดงความคิดเห็นโดยอ้างถึง ความคิดเห็นนี้
Date : 2014-02-01 23:02:05 By : weaned
 

 

No. 11



โพสกระทู้ ( 316 )
บทความ ( 0 )



สถานะออฟไลน์


ตอบความคิดเห็นที่ : 10 เขียนโดย : weaned เมื่อวันที่ 2014-02-01 23:02:05
รายละเอียดของการตอบ ::
... MYSQL ไม่มีปัญหาครับมีปัญหากับ MSSQL ครับในหน้านี้ผมดึงข้อมูลมาทั้งสองที่ครับ.......

แสดงความคิดเห็นโดยอ้างถึง ความคิดเห็นนี้
Date : 2014-02-01 23:30:32 By : karurub
 

 

No. 12



โพสกระทู้ ( 316 )
บทความ ( 0 )



สถานะออฟไลน์


Code ที่ผมส่งให้ดูทำไมมันโดนตัดเหลือแค่ส่วนบนไม่รู้ เพราะส่วนบนผมเช็คกับ MySQL มันไม่มีปัญหา แต่ทื่มีปัญหา มันอยู่การติดต่อข้อมูลใน MSSQL งั้นผมขอ แสดงอีกครั้งนะครับผมจะตัดส่วนบนออกไปแล้วกันเพื่อกัน งงครับ

Code (PHP)
001.<html>
002.<head>
003. 
004. 
005.<script language=JavaScript>
006. 
007.var datePickerDivID = "datepicker";
008.var iFrameDivID = "datepickeriframe";
009. 
010.var dayArrayShort = new Array('Su', 'Mo', 'Tu', 'We', 'Th', 'Fr', 'Sa');
011.var dayArrayMed = new Array('Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat');
012.var dayArrayLong = new Array('Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday',
013. 
014.'Friday', 'Saturday');
015.var monthArrayShort = new Array('Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug',
016. 
017.'Sep', 'Oct', 'Nov', 'Dec');
018.var monthArrayMed = new Array('Jan', 'Feb', 'Mar', 'Apr', 'May', 'June', 'July', 'Aug',
019. 
020.'Sept', 'Oct', 'Nov', 'Dec');
021.var monthArrayLong = new Array('January', 'February', 'March', 'April', 'May', 'June',
022. 
023.'July', 'August', 'September', 'October', 'November', 'December');
024.  
025.var defaultDateSeparator = "-";        // ÃٻẺµÑǤÑè¹ÃÐËÇèÒ§ Çѹ à´×͹ »Õ (ÁÕ "/" or ".")
026.var defaultDateFormat = "ymd"    // ãÊèÃٻẺ¡ÒÃàÃÕ§ÅӴѺ¢Í§ Çѹ à´×͹ »Õ ¤ÃѺ (ÁÕ "mdy",
027. 
028."dmy", and "ymd")
029.var dateSeparator = defaultDateSeparator;
030.var dateFormat = defaultDateFormat;
031. 
032. 
033.function displayDatePicker(dateFieldName, displayBelowThisObject, dtFormat, dtSep)
034.{
035.  var targetDateField = document.getElementsByName (dateFieldName).item(0);
036.  
037.  // if we weren't told what node to display the datepicker beneath, just display it
038.  // beneath the date field we're updating
039.  if (!displayBelowThisObject)
040.    displayBelowThisObject = targetDateField;
041.  
042.  // if a date separator character was given, update the dateSeparator variable
043.  if (dtSep)
044.    dateSeparator = dtSep;
045.  else
046.    dateSeparator = defaultDateSeparator;
047.  
048.  // if a date format was given, update the dateFormat variable
049.  if (dtFormat)
050.    dateFormat = dtFormat;
051.  else
052.    dateFormat = defaultDateFormat;
053.  
054.  var x = displayBelowThisObject.offsetLeft;
055.  var y = displayBelowThisObject.offsetTop + displayBelowThisObject.offsetHeight ;
056.  
057.  // deal with elements inside tables and such
058.  var parent = displayBelowThisObject;
059.  while (parent.offsetParent) {
060.    parent = parent.offsetParent;
061.    x += parent.offsetLeft;
062.    y += parent.offsetTop ;
063.  }
064.  
065.  drawDatePicker(targetDateField, x, y);
066.}
067. 
068. 
069.function drawDatePicker(targetDateField, x, y)
070.{
071.  var dt = getFieldDate(targetDateField.value );
072.  
073.  // the datepicker table will be drawn inside of a <div> with an ID defined by the
074.  // global datePickerDivID variable. If such a div doesn't yet exist on the HTML
075.  // document we're working with, add one.
076.  if (!document.getElementById(datePickerDivID)) {
077.    // don't use innerHTML to update the body, because it can cause global variables
078.    // that are currently pointing to objects on the page to have bad references
079.    //document.body.innerHTML += "<div id='" + datePickerDivID + "' class='dpDiv'></div>";
080.    var newNode = document.createElement("div");
081.    newNode.setAttribute("id", datePickerDivID);
082.    newNode.setAttribute("class", "dpDiv");
083.    newNode.setAttribute("style", "visibility: hidden;");
084.    document.body.appendChild(newNode);
085.  }
086.  
087.  // move the datepicker div to the proper x,y coordinate and toggle the visiblity
088.  var pickerDiv = document.getElementById(datePickerDivID);
089.  pickerDiv.style.position = "absolute";
090.  pickerDiv.style.left = x + "px";
091.  pickerDiv.style.top = y + "px";
092.  pickerDiv.style.visibility = (pickerDiv.style.visibility == "visible" ? "hidden" :
093. 
094."visible");
095.  pickerDiv.style.display = (pickerDiv.style.display == "block" ? "none" : "block");
096.  pickerDiv.style.zIndex = 10000;
097.  
098.  // draw the datepicker table
099.  refreshDatePicker(targetDateField.name, dt.getFullYear(), dt.getMonth(), dt.getDate());
100.}
101. 
102.function refreshDatePicker(dateFieldName, year, month, day)
103.{
104.  // if no arguments are passed, use today's date; otherwise, month and year
105.  // are required (if a day is passed, it will be highlighted later)
106.  var thisDay = new Date();
107.  
108.  if ((month >= 0) && (year > 0)) {
109.    thisDay = new Date(year, month, 1);
110.  } else {
111.    day = thisDay.getDate();
112.    thisDay.setDate(1);
113.  }
114.  
115.  // the calendar will be drawn as a table
116.  // you can customize the table elements with a global CSS style sheet,
117.  // or by hardcoding style and formatting elements below
118.  var crlf = "\r\n";
119.  var TABLE = "<table cols=7 class='dpTable'>" + crlf;
120.  var xTABLE = "</table>" + crlf;
121.  var TR = "<tr class='dpTR'>";
122.  var TR_title = "<tr class='dpTitleTR'>";
123.  var TR_days = "<tr class='dpDayTR'>";
124.  var TR_todaybutton = "<tr class='dpTodayButtonTR'>";
125.  var xTR = "</tr>" + crlf;
126.  var TD = "<td class='dpTD' onMouseOut='this.className=\"dpTD\";' onMouseOver='
127. 
128.this.className=\"dpTDHover\";' ";    // leave this tag open, because we'll be adding an
129. 
130.onClick event
131.  var TD_title = "<td colspan=5 class='dpTitleTD'>";
132.  var TD_buttons = "<td class='dpButtonTD'>";
133.  var TD_todaybutton = "<td colspan=7 class='dpTodayButtonTD'>";
134.  var TD_days = "<td class='dpDayTD'>";
135.  var TD_selected = "<td class='dpDayHighlightTD' onMouseOut='this.className=
136. 
137.\"dpDayHighlightTD\";' onMouseOver='this.className=\"dpTDHover\";' ";    // leave this tag
138. 
139.open, because we'll be adding an onClick event
140.  var xTD = "</td>" + crlf;
141.  var DIV_title = "<div class='dpTitleText'>";
142.  var DIV_selected = "<div class='dpDayHighlight'>";
143.  var xDIV = "</div>";
144.  
145.  // start generating the code for the calendar table
146.  var html = TABLE;
147.  
148.  // this is the title bar, which displays the month and the buttons to
149.  // go back to a previous month or forward to the next month
150.  html += TR_title;
151.  html += TD_buttons + getButtonCode(dateFieldName, thisDay, -1, "<") + xTD;
152.  html += TD_title + DIV_title + monthArrayLong[ thisDay.getMonth()] + " " +
153. 
154.thisDay.getFullYear() + xDIV + xTD;
155.  html += TD_buttons + getButtonCode(dateFieldName, thisDay, 1, ">") + xTD;
156.  html += xTR;
157.  
158.  // this is the row that indicates which day of the week we're on
159.  html += TR_days;
160.  for(i = 0; i < dayArrayShort.length; i++)
161.    html += TD_days + dayArrayShort[i] + xTD;
162.  html += xTR;
163.  
164.  // now we'll start populating the table with days of the month
165.  html += TR;
166.  
167.  // first, the leading blanks
168.  for (i = 0; i < thisDay.getDay(); i++)
169.    html += TD + " " + xTD;
170.  
171.  // now, the days of the month
172.  do {
173.    dayNum = thisDay.getDate();
174.    TD_onclick = " onclick=\"updateDateField('" + dateFieldName + "', '" + getDateString
175. 
176.(thisDay) + "');\">";
177.     
178.    if (dayNum == day)
179.      html += TD_selected + TD_onclick + DIV_selected + dayNum + xDIV + xTD;
180.    else
181.      html += TD + TD_onclick + dayNum + xTD;
182.     
183.    // if this is a Saturday, start a new row
184.    if (thisDay.getDay() == 6)
185.      html += xTR + TR;
186.     
187.    // increment the day
188.    thisDay.setDate(thisDay.getDate() + 1);
189.  } while (thisDay.getDate() > 1)
190.  
191.  // fill in any trailing blanks
192.  if (thisDay.getDay() > 0) {
193.    for (i = 6; i > thisDay.getDay(); i--)
194.      html += TD + " " + xTD;
195.  }
196.  html += xTR;
197.  
198.  // add a button to allow the user to easily return to today, or close the calendar
199.  var today = new Date();
200.  var todayString = "Today is " + dayArrayMed[today.getDay()] + ", " + monthArrayMed[
201. 
202.today.getMonth()] + " " + today.getDate();
203.  html += TR_todaybutton + TD_todaybutton;
204.  html += "<button class='dpTodayButton' onClick='refreshDatePicker(\"" + dateFieldName +
205. 
206."\");'>this month</button> ";
207.  html += "<button class='dpTodayButton' onClick='updateDateField(\"" + dateFieldName +
208. 
209."\");'>close</button>";
210.  html += xTD + xTR;
211.  
212.  // and finally, close the table
213.  html += xTABLE;
214.  
215.  document.getElementById(datePickerDivID).innerHTML = html;
216.  // add an "iFrame shim" to allow the datepicker to display above selection lists
217.  adjustiFrame();
218.}
219. 
220.function getButtonCode(dateFieldName, dateVal, adjust, label)
221.{
222.  var newMonth = (dateVal.getMonth () + adjust) % 12;
223.  var newYear = dateVal.getFullYear() + parseInt((dateVal.getMonth() + adjust) / 12);
224.  if (newMonth < 0) {
225.    newMonth += 12;
226.    newYear += -1;
227.  }
228.  
229.  return "<button class='dpButton' onClick='refreshDatePicker(\"" + dateFieldName + "\", " +
230. 
231.newYear + ", " + newMonth + ");'>" + label + "</button>";
232.}
233. 
234.function getDateString(dateVal)
235.{
236.  var dayString = "00" + dateVal.getDate();
237.  var monthString = "00" + (dateVal.getMonth()+1);
238.  dayString = dayString.substring(dayString.length - 2);
239.  monthString = monthString.substring(monthString.length - 2);
240.  
241.  switch (dateFormat) {
242.    case "dmy" :
243.      return dayString + dateSeparator + monthString + dateSeparator + dateVal.getFullYear
244. 
245.();
246.    case "ymd" :
247.      return dateVal.getFullYear() + dateSeparator + monthString + dateSeparator +
248. 
249.dayString;
250.    case "mdy" :
251.    default :
252.      return monthString + dateSeparator + dayString + dateSeparator + dateVal.getFullYear
253. 
254.();
255.  }
256.}
257. 
258. 
259.function getFieldDate(dateString)
260.{
261.  var dateVal;
262.  var dArray;
263.  var d, m, y;
264.  
265.  try {
266.    dArray = splitDateString(dateString);
267.    if (dArray) {
268.      switch (dateFormat) {
269.        case "dmy" :
270.          d = parseInt(dArray[0], 10);
271.          m = parseInt(dArray[1], 10) - 1;
272.          y = parseInt(dArray[2], 10);
273.          break;
274.        case "ymd" :
275.          d = parseInt(dArray[2], 10);
276.          m = parseInt(dArray[1], 10) - 1;
277.          y = parseInt(dArray[0], 10);
278.          break;
279.        case "mdy" :
280.        default :
281.          d = parseInt(dArray[1], 10);
282.          m = parseInt(dArray[0], 10) - 1;
283.          y = parseInt(dArray[2], 10);
284.          break;
285.      }
286.      dateVal = new Date(y, m, d);
287.    } else if (dateString) {
288.      dateVal = new Date(dateString);
289.    } else {
290.      dateVal = new Date();
291.    }
292.  } catch(e) {
293.    dateVal = new Date();
294.  }
295.  
296.  return dateVal;
297.}
298. 
299. 
300.function splitDateString(dateString)
301.{
302.  var dArray;
303.  if (dateString.indexOf("/") >= 0)
304.    dArray = dateString.split("/");
305.  else if (dateString.indexOf(".") >= 0)
306.    dArray = dateString.split(".");
307.  else if (dateString.indexOf("-") >= 0)
308.    dArray = dateString.split("-");
309.  else if (dateString.indexOf("\\") >= 0)
310.    dArray = dateString.split("\\");
311.  else
312.    dArray = false;
313.  
314.  return dArray;
315.}
316. 
317. 
318.function updateDateField(dateFieldName, dateString)
319.{
320.  var targetDateField = document.getElementsByName (dateFieldName).item(0);
321.  if (dateString)
322.    targetDateField.value = dateString;
323.  
324.  var pickerDiv = document.getElementById(datePickerDivID);
325.  pickerDiv.style.visibility = "hidden";
326.  pickerDiv.style.display = "none";
327.  
328.  adjustiFrame();
329.  targetDateField.focus();
330.  
331.  // after the datepicker has closed, optionally run a user-defined function called
332.  // datePickerClosed, passing the field that was just updated as a parameter
333.  // (note that this will only run if the user actually selected a date from the datepicker)
334.  if ((dateString) && (typeof(datePickerClosed) == "function"))
335.    datePickerClosed(targetDateField);
336.}
337. 
338. 
339.function adjustiFrame(pickerDiv, iFrameDiv)
340.{
341.  // we know that Opera doesn't like something about this, so if we
342.  // think we're using Opera, don't even try
343.  var is_opera = (navigator.userAgent.toLowerCase().indexOf("opera") != -1);
344.  if (is_opera)
345.    return;
346.   
347.  // put a try/catch block around the whole thing, just in case
348.  try {
349.    if (!document.getElementById(iFrameDivID)) {
350.      // don't use innerHTML to update the body, because it can cause global variables
351.      // that are currently pointing to objects on the page to have bad references
352.      //document.body.innerHTML += "<iframe id='" + iFrameDivID + "' src='javascript:false;'
353. 
354.scrolling='no' frameborder='0'>";
355.      var newNode = document.createElement("iFrame");
356.      newNode.setAttribute("id", iFrameDivID);
357.      newNode.setAttribute("src", "javascript:false;");
358.      newNode.setAttribute("scrolling", "no");
359.      newNode.setAttribute ("frameborder", "0");
360.      document.body.appendChild(newNode);
361.    }
362.     
363.    if (!pickerDiv)
364.      pickerDiv = document.getElementById(datePickerDivID);
365.    if (!iFrameDiv)
366.      iFrameDiv = document.getElementById(iFrameDivID);
367.     
368.    try {
369.      iFrameDiv.style.position = "absolute";
370.      iFrameDiv.style.width = pickerDiv.offsetWidth;
371.      iFrameDiv.style.height = pickerDiv.offsetHeight ;
372.      iFrameDiv.style.top = pickerDiv.style.top;
373.      iFrameDiv.style.left = pickerDiv.style.left;
374.      iFrameDiv.style.zIndex = pickerDiv.style.zIndex - 1;
375.      iFrameDiv.style.visibility = pickerDiv.style.visibility ;
376.      iFrameDiv.style.display = pickerDiv.style.display;
377.    } catch(e) {
378.    }
379.  
380.  } catch (ee) {
381.  }
382.  
383.}
384. 
385.</script>
386.<?
387.function DateThai($strDate)
388.{
389.$strYear = date("Y",strtotime($strDate))+543;
390.$strMonth= date("n",strtotime($strDate));
391.$strDay= date("j",strtotime($strDate));
392.$strHour= date("H",strtotime($strDate));
393.$strMinute= date("i",strtotime($strDate));
394.$strSeconds= date("s",strtotime($strDate));
395.$strMonthCut = Array
396. 
397.("","?.?.","?.?.","??.?.","??.?.","?.?.","??.?.","?.?.","?.?.","?.?.","?.?.","?.?.","?.?.");
398.//$strMonthCut = Array("",'January', 'February', 'March', 'April', 'May', 'June', 'July',
399. 
400.'August', 'September', 'October', 'November', 'December');
401.$strMonthThai=$strMonthCut[$strMonth];
402.//return "$strDay $strMonthThai $strYear, $strHour:$strMinute";
403.return "$strHour:$strMinute";
404.}
405.//$strDate = $objResult["createTime"];
406.//echo "Test : ".DateThai($strDate);
407.?>
408.<style>
409. 
410./* the div that holds the date picker calendar */
411..dpDiv {
412.    }
413. 
414./* the table (within the div) that holds the date picker calendar */
415..dpTable {
416.    font-family: Tahoma, Arial, Helvetica, sans-serif;
417.    font-size: 12px;
418.    text-align: center;
419.    color: #505050;
420.    background-color: #ece9d8;
421.    border: 1px solid #AAAAAA;
422.    }
423. 
424./* a table row that holds date numbers (either blank or 1-31) */
425..dpTR {
426.    }
427. 
428./* the top table row that holds the month, year, and forward/backward buttons */
429..dpTitleTR {
430.    }
431. 
432./* the second table row, that holds the names of days of the week (Mo, Tu, We, etc.) */
433..dpDayTR {
434.    }
435. 
436./* the bottom table row, that has the "This Month" and "Close" buttons */
437..dpTodayButtonTR {
438.    }
439. 
440./* a table cell that holds a date number (either blank or 1-31) */
441..dpTD {
442.    border: 1px solid #ece9d8;
443.    }
444. 
445./* a table cell that holds a highlighted day (usually either today's date or the current
446. 
447.date field value) */
448..dpDayHighlightTD {
449.    background-color: #CCCCCC;
450.    border: 1px solid #AAAAAA;
451.    }
452. 
453./* the date number table cell that the mouse pointer is currently over (you can use
454. 
455.contrasting colors to make it apparent which cell is being hovered over) */
456..dpTDHover {
457.    background-color: #aca998;
458.    border: 1px solid #888888;
459.    cursor: pointer;
460.    color: red;
461.    }
462. 
463./* the table cell that holds the name of the month and the year */
464..dpTitleTD {
465.    }
466. 
467./* a table cell that holds one of the forward/backward buttons */
468..dpButtonTD {
469.    }
470. 
471./* the table cell that holds the "This Month" or "Close" button at the bottom */
472..dpTodayButtonTD {
473.    }
474. 
475./* a table cell that holds the names of days of the week (Mo, Tu, We, etc.) */
476..dpDayTD {
477.    background-color: #CCCCCC;
478.    border: 1px solid #AAAAAA;
479.    color: white;
480.    }
481. 
482./* additional style information for the text that indicates the month and year */
483..dpTitleText {
484.    font-size: 12px;
485.    color: gray;
486.    font-weight: bold;
487.    }
488. 
489./* additional style information for the cell that holds a highlighted day (usually either
490. 
491.today's date or the current date field value) */
492..dpDayHighlight {
493.    color: 4060ff;
494.    font-weight: bold;
495.    }
496. 
497./* the forward/backward buttons at the top */
498..dpButton {
499.    font-family: Verdana, Tahoma, Arial, Helvetica, sans-serif;
500.    font-size: 10px;
501.    color: gray;
502.    background: #d8e8ff;
503.    font-weight: bold;
504.    padding: 0px;
505.    }
506. 
507./* the "This Month" and "Close" buttons at the bottom */
508..dpTodayButton {
509.    font-family: Verdana, Tahoma, Arial, Helvetica, sans-serif;
510.    font-size: 10px;
511.    color: gray;
512.    background: #d8e8ff;
513.    font-weight: bold;
514.    }
515..style3 {font-size: 5px}
516..style7 {font-size: 12px; }
517..style8 {font-size: 12px; font-family: Tahoma, Arial, Helvetica, sans-serif; }
518..style9 {
519.    color: #FFFFFF;
520.    font-weight: bold;
521.}
522..style13 {font-size: 12px; color: #FFFFFF; font-weight: bold; }
523..style14 {color: #0000FF}
524..style15 {color: #FF0000}
525.</style>
526.<title>-: CRM :-</title>
527.<script src="Scripts/AC_RunActiveContent.js" type="text/javascript"></script>
528.<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
529.</head>
530.<?
531.    $objConnect = mssql_connect("192.168.1.3\SQL2005","sa","sa191") or die("Error
532. 
533.Connect to Database");
534.    $objDB = mssql_select_db("Golive");
535.?>
536.<body>
537.<p align="right">
538.<script language="JavaScript">
539.function ClickCheckAll(vol)
540.{
541.var i=1;
542.for(i=1;i<=document.frmSearch0.hdnCount.value;i++)
543.{
544.if(vol.checked == true)
545.{
546.eval("document.frmSearch0.ck"+i+".checked=true");
547.}
548.else
549.{
550.eval("document.frmSearch0.ck"+i+".checked=false");
551.}
552.}
553.}
554. 
555.</script>
556.<span class="style14">Welcome :
557.  <?=$objResult["U_firstname"];?>   
558.  <? include "menu.php"; ?>
559.</span></p>
560.<form name="frmSearch0" method="get" action="<?=$_SERVER['SCRIPT_NAME'];?>">
561.  <table width="100%" border="0" align="center">
562.    <tr>
563.      <th height="52" align="center" valign="top"><script type="text/javascript">
564.AC_FL_RunContent(
565. 
566.'codebase','http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,
567. 
568.28,0','width','900','height','34','src','flash/topmenu1','quality','high','pluginspage','htt
569. 
570.p://www.adobe.com/shockwave/download/download.cgi?
571. 
572.P1_Prod_Version=ShockwaveFlash','movie','flash/topmenu1' ); //end AC code
573.  </script>
574.          <noscript>
575.            <object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"
576. 
577.codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,28
578. 
579.,0" width="900" height="34">
580.            <param name="movie" value="flash/topmenu1.swf">
581.            <param name="quality" value="high">
582.            <embed src="flash/topmenu1.swf" quality="high"
583. 
584.pluginspage="http://www.adobe.com/shockwave/download/download.cgi?
585. 
586.P1_Prod_Version=ShockwaveFlash" type="application/x-shockwave-flash" width="900"
587. 
588.height="34"></embed>
589.          </object>
590.          </noscript></th>
591.    </tr>
592.    <tr>
593.      <th class="style7">-: Date :- <span class="style3">
594.        <input name="txtKeyword0" type="text" id="txtKeyword0" value="<?=$_GET
595. 
596.["txtKeyword0"];?>">
597.        <a href="javascript:displayDatePicker('txtKeyword0')"> <img border="0" src="images
598. 
599.\cal.gif" width="16" height="16"></a> </span>-: To :-
600.        <input name="txtKeyword1" type="text" id="txtKeyword1" value="<?=$_GET
601. 
602.["txtKeyword1"];?>">
603.        <a href="javascript:displayDatePicker('txtKeyword1')"> <img border="0" src="images
604. 
605.\cal.gif" width="16" height="16"></a><?php /*?> -: Technician :- <span class="style3">
606.        <select name="lmName">
607.          <option value="">Please Select Name</option>
608.          <?
609.                    $strSQL = "select * from ohem where
610. 
611.ohem.dept='2'ORDER BY empID ASC";
612.                    $objQuery = mssql_query($strSQL);
613.                    while($objResult = mssql_fetch_array($objQuery))
614.                    {
615.            ?>
616.          <option value="<?=$objResult["empID"];?>">
617.          <?=$objResult["empID"]." - ".$objResult["firstName"];?>
618.          </option>
619.          <?
620.                    }
621.            ?>
622.        </select><?php */?>
623.        <?php /*?>
624.        </span> -: Status :-<span class="style3">
625.        <input name="CheckAll" type="checkbox" id="CheckAll" value="Y"
626. 
627.onClick="ClickCheckAll(this);">
628.        <span class="style14 style7">All</span> </span> <span class="style3">
629.        <label>
630.        <input type="checkbox" name="ck1" id="ck1" value="Open">
631.        </label>
632.        </span>
633.        <label><span class="style14">Open</span></label>
634.        <span class="style3">
635.        <label>
636.        <input type="checkbox" name="ck2" id="ck2" value="Pending">
637.        </label>
638.        </span>
639.        <label><span class="style14">Pending</span></label>
640.        <span class="style3">
641.        <label>
642.        <input type="checkbox" name="ck3" id="ck3" value="In progress">
643.        </label>
644.        </span>
645.        <label> <span class="style14">In progress</span> </label>
646.        <span class="style3">
647.        <label>
648.        <input type="checkbox" name="ck4" id="ck4" value="Closed">
649.        </label>
650.        </span>
651.        <label> <span class="style14">Closed</span> </label>
652.        <span class="style3">
653.        <input type="hidden" name="hdnCount" value="4"><?php */?>
654.        <input type="submit" value="Search">
655.      </span></th>
656.    </tr>
657.  </table>
658.</form>
659. 
660.<?
661.if($_GET["txtKeyword0"] != "")
662.    {
663.    $strSQL =
664.     
665. 
666.    "SELECT
667.        CONVERT(varchar(10),T0.DocDate,103) as DocDate,
668.        T0.DocNum,
669.        T0.DocTime,
670.        T0.CardCode,
671.        T0.CardName,
672.        T0.U_ItemCode,
673.        T0.U_SerialNum,
674.        T0.U_ServiceCode,
675.        T0.U_DNServiceItem,
676.        T0.Comments,
677.        T0.U_msgr,
678.        T0.U_msgrComment,
679.        T1.Quantity,
680.        T1.ItemCode,
681.        T1.Dscription,
682.        T2.firstName
683.    FROM
684.        ODLN T0 INNER JOIN DLN1  T1 ON T0.DocEntry = T1.DocEntry
685.        INNER JOIN OHEM T2 ON T0.OwnerCode = T2.empID
686.    WHERE
687.        ((T0.createDate BETWEEN '".$_GET["txtKeyword0"]."' AND '".$_GET
688. 
689.["txtKeyword1"]."')
690.        AND T1.U_SaleType ='Issue')
691.    ORDER BY
692.    T2.firstName";
693.     
694.     
695.     
696.    $objQuery = mssql_query($strSQL) or die ("Error Query [".$strSQL."]");
697.?>
698. 
699.    <table width="1024" border="1" align="center" cellspacing="0" bordercolor="#000000"
700. 
701.bgcolor="#0033FF">
702.      <tr>
703.        <th width="23"> <div align="center" class="style9 style7">No.</div></th>
704.        <th width="42"> <div align="center" class="style13">SO No.</div></th>
705.        <th width="58"> <div align="center" class="style13">Create Date</div></th>
706.        <th width="62"> <div align="center" class="style13">Customer Code</div></th>
707.        <th width="114"> <div align="center" class="style13">Customer
708. 
709.Name</div></th>
710.        <th width="72"> <div align="center" class="style13">Item No</div></th>
711.        <th width="80"> <div align="center" class="style13">Item Code</div></th>
712.        <th width="61"> <div align="center" class="style13">Description</div></th>
713.        <th width="70"> <div align="center" class="style13">Serial No.</div></th>
714.        <th width="70"> <div align="center" class="style13">Service Code</div></th>
715.        <th width="23"> <div align="center" class="style13">Qty.</div></th>
716.        <th width="38"> <div align="center" class="style13">Status</div></th>
717.        <th width="62"> <div align="center" class="style13">Technician Name</div></th>
718.        <th width="78"> <div align="center" class="style13">Comment</span></div></th>
719.        <th width="27"> <div align="center" class="style13">Msgr</div></th>
720.        <th width="78"> <div align="center" class="style13">Comment Msgr</div></th>
721.      </tr>
722.    <?
723.        $i=1;
724.        $j=1;
725.    while($objResult = mssql_fetch_array($objQuery))
726.    {
727.        $j++;
728.        /*if($objResult["DocStatus"] == 'O')
729.        {
730.            $bg = "#FF0000";
731.        }
732.        else */if($j%2==0)
733.        {
734.            $bg = "#99CCFF";
735.        }
736.        else
737.        {
738.            $bg = "#FFFFFF";
739.        }
740.    ?>
741.    <?
742.        $DocTime1 = substr($objResult["DocTime"],-2);
743.        $DocTime2 = substr($objResult["DocTime"],0,-2);
744.        $DocTime = $DocTime2 .":".$DocTime1;
745.         
746.    ?>
747.      <tr bgcolor="<?=$bg;?>">
748.        <td><div align="center" class="style8"><?=$i;?></div></td>
749.        <td><div align="center"><span class="style8"><?=$objResult["DocNum"];?
750. 
751.></span></div></td>
752.        <td><div align="center"><span class="style8"><?=$objResult["DocDate"]." ".
753. 
754.$DocTime;?></span></div></td>
755.        <td><div align="center"><span class="style8">
756.        <?=$objResult["CardCode"];?>
757.        </span></div></td>
758.        <td><span class="style8"><?=$objResult["CardName"];?></span></td>
759.        <td><div align="center"><span class="style8">
760.        <?=$objResult["ItemCode"];?>
761.        </span></div></td>
762.        <td><div align="center"><span class="style8"><?=$objResult["U_ItemCode"];?
763. 
764.></span></div></td>
765.        <td><div align="left"><span class="style8">
766.        <?=$objResult["Dscription"];?>
767.        </span></div></td>
768.        <td><div align="center"><span class="style8">
769.        <?=$objResult["U_SerialNum"];?>
770.        </span></div></td>
771.        <td><div align="center"><span class="style8"><?=$objResult["U_ServiceCode"];?
772. 
773.></span></div></td>
774.        <td><div align="center"><span class="style8"><?=substr($objResult["Quantity"],0,-
775. 
776.7);?></span></div></td>
777.        <td><div align="center"><span class="style8">
778.        <?
779.        if($objResult["U_DNServiceItem,"]=='O')
780.            {
781.                echo "<font color=\"red\">YES</font>";
782.            }
783.            else
784.            {
785.                echo "<font color=\"black\">NO</font>";
786.            }
787.        ?></span></div></td>
788.        <td><div align="center"><span class="style8"><?=$objResult["firstName"];?
789. 
790.></span></div></td>
791.        <td><div align="left"><span class="style8">
792.        <?=$objResult["Comments"];?>
793.        </span></div></td>
794.        <td><div align="center"><span class="style8"><?=$objResult["U_msgr"];?
795. 
796.></span></div></td>
797.        <td><div align="left"><span class="style8">
798.        <?=$objResult["U_msgeComment"];?>
799.        </span></div></td>
800.         
801.        
802.      </tr>
803.    <?
804.        $i++;
805.    }
806.    ?>
807.</table>
808. 
809.<?
810.    mssql_close($objConnect);
811.}
812.?>
813.</body>
814.</html>



ประวัติการแก้ไข
2014-02-04 04:06:07
2014-02-04 04:14:52
แสดงความคิดเห็นโดยอ้างถึง ความคิดเห็นนี้
Date : 2014-02-04 04:04:22 By : karurub
 

 

No. 13



โพสกระทู้ ( 1,096 )
บทความ ( 0 )

สมาชิกที่ใส่เสื้อไทยครีเอท

สถานะออฟไลน์


จัดไป เอาไว้สำหรับแสดงผล
แต่ head ต้องกำหนด เป็นแบบ <meta charset="utf-8">
https://www.thaicreate.com/php/forum/101014.html

ส่วนฟังก์ชั่นนี้เอาไว้สำหรับ insert เพราะส่วนมากเราจะกำหนดภาษาตอนสร้างฐานข้อมูลเป็น tis620

Code (PHP)
01.function utf8_to_tis620($string) {
02.   $str = $string;
03.   $res = "";
04.   for ($i = 0; $i < strlen($str); $i++) {
05.      if (ord($str[$i]) == 224) {
06.        $unicode = ord($str[$i+2]) & 0x3F;
07.        $unicode |= (ord($str[$i+1]) & 0x3F) << 6;
08.        $unicode |= (ord($str[$i]) & 0x0F) << 12;
09.        $res .= chr($unicode-0x0E00+0xA0);
10.        $i += 2;
11.      } else {
12.        $res .= $str[$i];
13.      }
14.   }
15.   return $res;
16.}

แสดงความคิดเห็นโดยอ้างถึง ความคิดเห็นนี้
Date : 2014-02-04 09:30:01 By : compiak
 

   

ค้นหาข้อมูล


   
 

แสดงความคิดเห็น
Re : มีปัญหากับภาษาไทย ที่ดึงข้อมูลมาจาก MSSQL เวลาแสดงข้อมูลกลายเป็น ??????
 
 
รายละเอียด
 
ตัวหนา ตัวเอียง ตัวขีดเส้นใต้ ตัวมีขีดกลาง| ตัวเรืองแสง ตัวมีเงา ตัวอักษรวิ่ง| จัดย่อหน้าอิสระ จัดย่อหน้าชิดซ้าย จัดย่อหน้ากึ่งกลาง จัดย่อหน้าชิดขวา| เส้นขวาง| ขนาดตัวอักษร แบบตัวอักษร
ใส่แฟลช ใส่รูป ใส่ไฮเปอร์ลิ้งค์ ใส่อีเมล์ ใส่ลิ้งค์ FTP| ใส่แถวของตาราง ใส่คอลัมน์ตาราง| ตัวยก ตัวห้อย ตัวพิมพ์ดีด| ใส่โค้ด ใส่การอ้างถึงคำพูด| ใส่ลีสต์
smiley for :lol: smiley for :ken: smiley for :D smiley for :) smiley for ;) smiley for :eek: smiley for :geek: smiley for :roll: smiley for :erm: smiley for :cool: smiley for :blank: smiley for :idea: smiley for :ehh: smiley for :aargh: smiley for :evil:
Insert PHP Code
Insert ASP Code
Insert VB.NET Code Insert C#.NET Code Insert JavaScript Code Insert C#.NET Code
Insert Java Code
Insert Android Code
Insert Objective-C Code
Insert XML Code
Insert SQL Code
Insert Code
เพื่อความเรียบร้อยของข้อความ ควรจัดรูปแบบให้พอดีกับขนาดของหน้าจอ เพื่อง่ายต่อการอ่านและสบายตา และตรวจสอบภาษาไทยให้ถูกต้อง

อัพโหลดแทรกรูปภาพ

Notice

เพื่อความปลอดภัยของเว็บบอร์ด ไม่อนุญาติให้แทรก แท็ก [img]....[/img] โดยการอัพโหลดไฟล์รูปจากที่อื่น เช่นเว็บไซต์ ฟรีอัพโหลดต่าง ๆ
อัพโหลดแทรกรูปภาพ ให้ใช้บริการอัพโหลดไฟล์ของไทยครีเอท และตัดรูปภาพให้พอดีกับสกรีน เพื่อความโหลดเร็วและไฟล์ไม่ถูกลบทิ้ง

   
  เพื่อความปลอดภัยและการตรวจสอบ กระทู้ที่แทรกไฟล์อัพโหลดไฟล์จากที่อื่น อาจจะถูกลบทิ้ง
 
โดย
อีเมล์
บวกค่าให้ถูก
<= ตัวเลขฮินดูอารบิก เช่น 123 (หรือล็อกอินเข้าระบบสมาชิกเพื่อไม่ต้องกรอก)





ThaiCreate.Com Logo
© www.ThaiCreate.Com. 2003-2025 All Rights Reserved.
ไทยครีเอทบริการ จัดทำดูแลแก้ไข Web Application ทุกรูปแบบ (PHP, .Net Application, VB.Net, C#)
[Conditions Privacy Statement] ติดต่อโฆษณา 081-987-6107 อัตราราคา คลิกที่นี่