หน้าแรก
 การบ้าน
  C/C++ new
  Java new
  Windows Phone
  แจ้งเรื่องที่ต้องการ
 บทความ
  .NET
  Android
  Blackberry
  C++Builder
  Delphi
  Java
  Mobile
  Open Source
  Pocket PC
  Visual Basic
  Web
  Windows Phone
  Others
 แบบเรียนฟรี
  ASP
  ASP.NET Webmatrix
  C++
  eVB
  J2ME
  Java
  PHP
 ซอร์สโค้ด
  Android
  ASP
  C++
  VC++
  CGI-Perl
  Delphi
  Java
  jQuery
  PHP
  Visual Basic
  .NET
 บริการจากเรา
  เปิดท้าย... ขายโค้ด
  Freeware
  อัตราค่าโฆษณา
  รายชื่อลูกค้า
  สถิติผู้เข้าเว็บ
 ดาว์นโหลด
 ค้นหาข้อมูล
 กระดานสนทนา
  .NET
  C/C++
  Delphi
  Java
  Palm/PocketPC
  Visual Basic
  Web
  อื่นๆ
 กระดานงาน
 ลิงค์เว็บ
 เกี่ยวกับผม
 อัตราค่าโฆษณา
Social Network

Facebook  Twitter  YouTube
 New Article
 Webboard
 Freelanceboard
Freeware
โปรแกรมเบอร์ดี (BerDee)
โปรแกรมเบอร์ดี (Android)
เกมส์เป่ายิ้งฉุบ
เกมส์เป่ายิ้งฉุบ(Android)
WebcamMonitor
WebcamMonitor(Windows)
scSendMail
scSendMail(Windows)
MSN Caption
MSN Caption(Windows)
  Freelance comment
  ติดต่อสอบถามมาได้ตลอดนะ...
2015-07-29 13:35:58
  ถ้าผมต้องการเว็บที่พัฒน...
2015-01-18 15:33:54
  ถ้าผมต้องการเว็บที่พัฒน...
2015-01-18 15:32:51
  ติดต่อสอบถามเข้ามาได้นะ...
2014-01-06 12:47:38
  ถ้ายังหาคนสอนไม่ได้ ก็ลอ...
2013-07-06 01:04:37
  สนใจส่งขอบเขตมาคุยราคาก...
2013-03-24 18:54:20
  ถ้ายังไม่มีคนรับงานติดต...
2012-12-16 19:18:14
  สนใจคะ ติดต่อ 0905076277...
2012-11-12 11:07:46
  รับทำโปรเจ็คนักศึกษาหรื...
2012-10-29 03:10:46
  sukit_te34@hotmail.com...
2012-10-29 03:09:36
  Webboard comment
  เขียนโปรแกรมภาษาจาวา
1.โ...

2023-09-12 11:40:28
  ต้องลอง debug ดูเองครับ
ไล่...

2023-06-08 18:03:06
  ร้านค้าแห่งหนึ่ง จะต้องน...
2021-09-21 08:47:08
  จงเขียนโปรแกรมดำเนินการ...
2021-05-07 15:06:11
  จงเขียนโปรแกรมสำหรับคำน...
2021-03-09 14:21:45
  ขอดู...
2021-01-04 23:56:45
  ขอโค้ดเพื่อทำการเรียนกา...
2020-12-09 23:02:09
  แล้ว ?...
2020-12-09 10:56:34
  จ้า...
2020-10-18 16:53:21
  พอดีผมเหลื่อแค่ตัดสต๊อก...
2020-05-31 21:49:43
  Homework comment
  เขียนโปรแกรมเพื่อรับค่า...
2022-02-24 10:45:17
  จากโค้ดนี้อะครับ พอดีลอง...
2021-03-22 01:22:39
  จากโค้ดนี้อะครับ พอดีลอง...
2021-03-22 01:22:39
  โจทย์การบ้าน c++ เขียนรูปแ...
2020-04-06 11:01:33
  แบบนี้ขอเป็น ภาษา php หน่อย...
2019-09-18 14:36:34
  ผมไม่อยากให้คุณได้คะแนน...
2019-04-27 01:29:07
  อาจารย์เขาบอกแนวข้อสอบม...
2019-04-27 00:44:29
  ขอสอบถามการเขียน c++ ครับ เ...
2018-04-02 12:19:21
  โค้ดตัวอย่างศึกษาให้เข้...
2017-11-26 14:50:05
  คำนวณค่าน้ำโดยรับค่ามิเ...
2017-11-20 23:15:26
  Article comment
  เท่าที่อ่าน error คือพื้นที่...
2022-03-23 13:56:48
  เรียน สอบถามปัญหา กับ อ.คร...
2022-01-24 17:39:49
  ต้องการ ให้เขียน โปรแกรม ...
2019-12-09 11:39:58
  รับเขียน arx จาก vc++ 2017 ล็อคโปร...
2019-09-19 09:48:09
  ทำการ register ไฟล์ที่ชื่อ mswinsck.oc...
2019-09-17 14:05:56
  ใน vb 6 ไม่มี component winsock เลยค่ะ ส...
2019-09-03 10:31:02
  รบกวนขอสอบถามหน่อยนะครั...
2019-03-04 05:31:04
  สามารถนำตัวหนังสือจากภา...
2018-12-25 08:54:32
  มีcode ของ VB ไหมค่ะ ถ้ามีรบกว...
2017-09-28 16:50:02
  น่าจะได้ครับ ไม่เคยลอง
...

2017-07-11 09:59:35
  9Mcode comment

Link Exchange

อัตราค่าโฆษณา
 
 Webboard

- - - - - - - - - - - - - - ผู้ให้การสนับสนุน- - - - - - - - - - - - - -

กระทู้ #3099 [Web] (จาก IP: 183.89.200.221)

php ส่งข้อมูล sql2008แล้วแสดงแสดงผลไม่เป็นไทย

------------------------------------
<?php
require_once ("inc/functions.php") ;
$view = $_GET['view'];
if ( in_array($account2, $editor_list) && $enable_edit ) {
if ($_GET['sidebar']) {
?>
<div id="item_title"><b class="title">ITEM PANEL MENU</b></div>
<div id="item_detail">
<p class="item_name" style="height: auto;"><img src="images/bullet.jpg" /> <a href="javascript: goPanelPage('add');">Add Item</a></p>
<p class="item_name" style="height: auto;"><img src="images/bullet.jpg" /> <a href="javascript: goPanelPage('modify');">Modify Items</a></p>
<p class="item_name" style="height: auto;"><img src="images/bullet.jpg" /> <a href="javascript: goPanelPage('<?php echo strtolower($cash_name) ;?>');">Add <?php echo $cash_name ;?></a></p>
</div>
<?php
}
else {
?>
<script type="text/javascript">
function addcash()
{
var account = $("#account").val();
var cash = $("#cash").val();

$.post("BackendPanel.php?view=<?php echo strtolower($cash_name) ;?>",{account: account, cash: cash},function(result){
$("#list").html(result);
});
}

function goViewPage(id)
{
goPanelPage('modify&page='+id);
}

function additem()
{
var form = $("#additem").serialize();

$.post("BackendPanel.php?view=add",form,function(result){
$("#list").html(result);
});
}

function edititem()
{
var form = $("#edititem").serialize();
var id = $("#listid").val();

$.post("BackendPanel.php?id="+id,form,function(result){
$("#list").html(result);
});
}

function switchBundle()
{
var display = $(".bundle:first").css("display");

if (display=="none")
$(".bundle").show();
else
$(".bundle").css("display","none");
}
</script>
<div id="item_cat"><b class="title">ITEM PANEL > <?php echo ($view == "add") ? "ADD ITEM" : ( ( $view == strtolower($cash_name)) ? "ADD " . strtoupper($cash_name) : "MODIFY ITEMS" ) ;?></b></div>
<div id="item_content">
<?php
switch ($view) {
case "add" :
if ( count($_POST)) {
$id = getLastID() + 1 ;
$query = "INSERT [{$mssql_db['webshop']}].dbo.PREMIUM_SHOP_TBL " ;
$fields = "(id" ;
$values = "VALUES ('" . $id . "'" ;
$i = 0 ;
foreach ($_POST as $field => $value) {
if ( ($field == "itemid" || $field == "name") && trim($value) == "" )
$error = true ;
if ($field == "price" || $field == "price_sale" || $field == "itemcount")
$value = abs($value) ;
if ($field == "desc")
$field = "[desc]" ;
if ($field == "isbundle" || $field == "forsale") {
if ($value == "on")
$value = 1 ;
else
$value = 0 ;
}
$fields .= ", " . $field ;
$values .= ", '" . preg_replace("/'/", "\'\'", $value) . "'" ;
}
$fields .= ")" ;
$values .= ")" ;
$query .= $fields . $values ;
if (!$error)
$result = mssql_query($query) ;
if ($result)
echo "<p style='text-align: center; color: green'>{$_POST['name']} added successfully.</p>" ;
else
echo "<p style='text-align: center; color: red'>Failed to add item.</p>" ;
}
?>
<style>
table th {padding: 1px; width: 100px;}
table td {border: 0;}
input, select, textarea {padding: 2px; width: 100%;}
select {width: 103%;}
</style>
<p>
<form action="javascript: additem();" id="additem">
<table style="width: 350px; margin: auto;">
<tr>
<th>Item ID:</th>
<td><input name="itemid" maxlength="8" /></td>
</tr>
<tr>
<th>Item Name:</th>
<td><input name="name" maxlength="75" /></td>
</tr>
<tr>
<th>Description:</th>
<td><textarea name="desc"></textarea></td>
</tr>
<tr>
<th>Count:</th>
<td><input name="itemcount" maxlength="4" /></td>
</tr>
<tr>
<th>Price:</th>
<td><input name="price" maxlength="8" /></td>
</tr>
<tr>
<th>Sale Price:</th>
<td><input name="price_sale" maxlength="8" value="0" /></td>
</tr>
<tr>
<th>Category:</th>
<td><select name="category"><option value="A">Special Bundles</option> <option value="B">Chance Boxes</option> <option value="C">New Player Packages</option> <option value="D">Upgrading</option> <option value="E">Stats & Awakenings</option> <option value="F">Functional Items</option> <option value="G">Buffs & Amps</option> <option value="H">Flasks & Potions</option> <option value="I">Food</option> <option value="J">Character</option> <option value="K">Storage</option> <option value="L">Guild & Party</option> <option value="M">Premium EXP Areas</option> <option value="N">Pick-Up Pets</option> <option value="O">Buff Pets</option> <option value="P">Pet Enhancements</option> <option value="Q">Pet Beads</option> <option value="R">Flying Items</option> <option value="S">Fashion Sets</option> <option value="T">Fashion Set Pieces</option> <option value="U">Clocks & Glasses</option> <option value="V">Hair</option> <option value="W">Furniture</option> <option value="X">Misc. Functional</option> <option value="Y">Misc. Fashion</option></select></td>
</tr>
<tr>
<th>Image Extension:</th>
<td><input name="image" maxlength="4" value="." /></td>
</tr>
<tr>
<th>Is Bundle:</th>
<td style="padding: 2px; border: 1px solid #ccc;"><input type="checkbox" name="isbundle" onclick="switchBundle();" /></td>
</tr>
<tr class="bundle">
<th>Item 1 ID:</th>
<td><input name="item1_id" maxlength="8" /></td>
</tr>
<tr class="bundle">
<th>Item 1 Name:</th>
<td><input name="item1_name" maxlength="75" /></td>
</tr>
<tr class="bundle">
<th>Item 1 Count:</th>
<td><input name="item1_count" maxlength="4" /></td>
</tr>
<tr class="bundle">
<th>Item 2 ID:</th>
<td><input name="item2_id" maxlength="8" /></td>
</tr>
<tr class="bundle">
<th>Item 2 Name:</th>
<td><input name="item2_name" maxlength="75" /></td>
</tr>
<tr class="bundle">
<th>Item 2 Count:</th>
<td><input name="item2_count" maxlength="4" /></td>
</tr>
<tr class="bundle">
<th>Item 3 ID:</th>
<td><input name="item3_id" maxlength="8" /></td>
</tr>
<tr class="bundle">
<th>Item 3 Name:</th>
<td><input name="item3_name" maxlength="75" /></td>
</tr>
<tr class="bundle">
<th>Item 3 Count:</th>
<td><input name="item3_count" maxlength="4" /></td>
</tr>
<tr class="bundle">
<th>Item 4 ID:</th>
<td><input name="item4_id" maxlength="8" /></td>
</tr>
<tr class="bundle">
<th>Item 4 Name:</th>
<td><input name="item4_name" maxlength="75" /></td>
</tr>
<tr class="bundle">
<th>Item 4 Count:</th>
<td><input name="item4_count" maxlength="4" /></td>
</tr>
<tr>
<th>For Sale:</th>
<td style="padding: 2px; border: 1px solid #ccc;"><input type="checkbox" checked name="forsale" /></td>
</tr>
<tr>
<td colspan="2" style="border: 0;"><input type="submit" value="Add Item" style="width: auto;" /></td>
</tr>
</table>
</form>
</p>
<?php
break ;
case strtolower($cash_name) :
?>
<p>Please enter a valid account name and a positive integer to add <?php echo $cash_name ;?> to a user's account.<br/>
<small><i>Negative values will be made positive, and if non-interger values in the <?php echo $cash_name ;?> field will be canceled.</i></small></p>
<p>
<form action="javascript: addcash();">
<table style="width: 190px; margin: auto;">
<tr>
<th style="padding: 1px;">Account:</th>
<td style="border: 0;"><input id="account" maxlength="16" style="padding: 2px;" /></td>
</tr>
<tr>
<th style="padding: 1px;"><?php echo $cash_name ;?>:</th>
<td style="border: 0;"><input id="cash" maxlength="10" style="padding: 2px;" /></td>
</tr>
<tr>
<td colspan="2" style="border: 0;"><input type="submit" value="Add <?php echo $cash_name ?>" style="padding: 2px;" /></td>
</tr>
</table>
</form>
<?php
if ( count($_POST)) {
if ( trim($_POST['account']) == "" || trim($_POST['cash']) == "" || !ctype_digit($_POST['cash'])) {
$error = "<div style='color: red; text-align: center;'>Failed to add {$cash_name}.</div>" ;
}
else {
$account = clean($_POST['account']) ;
$cash = clean( abs($_POST['cash'])) ;
$result = mssql_query("UPDATE [{$mssql_db['account']}].dbo.[CHR_LOG_INFO] SET cash = cash + {$cash} WHERE id_loginid = {$account}") ;
if ($result) {
$cash_result = mssql_query("SELECT TOP 1 {$cash_row} FROM [{$mssql_db['account']}].dbo.[CHR_LOG_INFO] WHERE id_loginid = {$account}") ;
$cash_array = mssql_fetch_array($cash_result) ;
$total_cash = $cash_array[$cash_row];
$error = "<div style='color: green; text-align: center;'><b>{$cash} {$cash_name}</b> has been added successfully to <b>{$_POST['account']}</b>'s account.<br/><b>Total Cash:</b> {$total_cash}</div>" ;
}
else
$error = "<div style='color: red; text-align: center;'>Failed to add <b>{$cash} {$cash_name}</b> to <b>{$_POST['account']}</b>'s account.</div>" ;
}
echo $error ;
}
?>
</p>
<?php
break ;
default :
if ($_GET['id']) {
$id = clean( abs($_GET['id'])) ;
$result = mssql_query("SELECT * FROM [{$mssql_db['webshop']}].dbo.PREMIUM_SHOP_TBL WHERE id = {$id}") ;
$row = mssql_fetch_array($result) ;
if ( !mssql_num_rows($result)) {
echo "<p style='text-align: center; color: #FF0000; padding-top: 30%; font-weight: bold'>Invalid item ID.</p>" ;
}
else
if ($_GET['view'] == "delete") {
if ( !isset ($_GET['confirm']))
echo
"<p style='text-align: center; color: #FF0000; padding-top: 25%; font-weight: bold'>Are you sure you wish to delete {$row['name']}?<br/><input type='button' value='Delete' onclick=\"goPanelPage('delete&id={$row['id']}&confirm');\" style='padding: 2px;' /> <input type='button' value='Cancel' onclick=\"goViewPage({$_SESSION['panelpage']});\" style='padding: 2px;' /></p>" ;
else {
$result = mssql_query("DELETE [{$mssql_db['webshop']}].dbo.PREMIUM_SHOP_TBL WHERE id = {$id}") ;
$lastpage = $_SESSION['panelpage'] ? $_SESSION['panelpage'] : 1 ;
if ($result)
echo "<p style='text-align: center; color: #FF0000; padding-top: 30%; font-weight: bold'>{$row['name']} deleted.<br/><a href=\"javascript: goViewPage({$lastpage});\">Back</a></p>" ;
else
echo "<p style='text-align: center; color: #FF0000; padding-top: 30%; font-weight: bold'>Failed to delete.<br/><a href=\"javascript: goViewPage({$lastpage});\">Back</a></p>" ;
}
}
else {
if ( count($_POST)) {
unset ($result) ;
if (!$_POST['isbundle'])
$_POST['isbundle'] = 0 ;
if (!$_POST['forsale'])
$_POST['forsale'] = 0 ;
$update = array() ;
foreach ($_POST as $field => $value) {
if ( ($field == "itemid" || $field == "name") && trim($value) == "" )
$error = true ;
if ($field == "price" || $field == "price_sale" || $field == "itemcount")
$value = abs($value) ;
if ($field == "isbundle" || $field == "forsale") {
if ($value)
$value = 1 ;
else
$value = 0 ;
}
if ($value != $row[$field]) {
if ( stristr($value, "'") || $field == "desc" )
$value = "'" . preg_replace("/'/", "''", $value) . "'" ;
else
$value = clean($value) ;
$update[$field] = $value ;
}
}
$query = "UPDATE [{$mssql_db['webshop']}].dbo.PREMIUM_SHOP_TBL SET " ;
if ( empty ($update))
$error = true ;
if (!$error) {
$i = 0 ;
foreach ($update as $row => $value) {
if ($i != 0)
$query .= "," ;
if ($row == "desc")
$row = "[desc]" ;
$query .= " {$row} = {$value}" ;
$i++;
}
$query .= " WHERE id = {$id}" ;
$result = mssql_query($query) ;
}
$item_name = $_POST['name'] ? $_POST['name'] : $row['name'];
if ($result) {
$row = $_POST ;
echo "<p style='text-align: center; color: green'>{$item_name} updated successfully.</p>" ;
}
else
echo "<p style='text-align: center; color: red'>Failed to update {$item_name}.</p>" ;
}
foreach ($row as $field => $value) {
$row[$field] = br( preg_replace("/'/", "\'", $value)) ;
}
?>
<script type="text/javascript">
$(document).ready(function() {
<?php
foreach ($row as $field => $value) {
if ($field == "desc") {
?>
$("textarea[name='<?php echo $field ;?>']").val('<?php echo $value ;?>');
<?php
}
else
if ($field == "category") {
?>
$("select[name='<?php echo $field ;?>']").val('<?php echo $value ;?>');
<?php
}
else
if ($field == "isbundle" || $field == "forsale") {
$onoff = $row[$field] ? "true" : "false"
?>
$("input[name='<?php echo $field ;?>']").attr('checked', <?php echo $onoff ;?>);
<?php
if ($field == "isbundle" && $onoff == "true") {
echo "$(\".bundle\").show();" ;
}
unset ($onoff) ;
}
else {
?>
$("input[name='<?php echo $field ;?>']").val('<?php echo $value ;?>');
<?php
}
}
?>
});
</script>
<style>
table th {padding: 1px; width: 100px;}
table td {border: 0;}
input, select, textarea {padding: 2px; width: 100%;}
select {width: 103%;}
</style>
<p>
<input id="listid" value="<?php echo $id ;?>" type="hidden" />
<form action="javascript: edititem();" id="edititem">
<table style="width: 350px; margin: auto;">
<tr>
<th>Item ID:</th>
<td><input name="itemid" maxlength="8" /></td>
</tr>
<tr>
<th>Item Name:</th>
<td><input name="name" maxlength="75" /></td>
</tr>
<tr>
<th>Description:</th>
<td><textarea name="desc"></textarea></td>
</tr>
<tr>
<th>Count:</th>
<td><input name="itemcount" maxlength="4" /></td>
</tr>
<tr>
<th>Price:</th>
<td><input name="price" maxlength="8" /></td>
</tr>
<tr>
<th>Sale Price:</th>
<td><input name="price_sale" maxlength="8" value="0" /></td>
</tr>
<tr>
<th>Category:</th>
<td><select name="category"><option value="A">Special Bundles</option> <option value="B">Chance Boxes</option> <option value="C">New Player Packages</option> <option value="D">Upgrading</option> <option value="E">Stats & Awakenings</option> <option value="F">Functional Items</option> <option value="G">Buffs & Amps</option> <option value="H">Flasks & Potions</option> <option value="I">Food</option> <option value="J">Character</option> <option value="K">Storage</option> <option value="L">Guild & Party</option> <option value="M">Premium EXP Areas</option> <option value="N">Pick-Up Pets</option> <option value="O">Buff Pets</option> <option value="P">Pet Enhancements</option> <option value="Q">Pet Beads</option> <option value="R">Flying Items</option> <option value="S">Fashion Sets</option> <option value="T">Fashion Set Pieces</option> <option value="U">Clocks & Glasses</option> <option value="V">Hair</option> <option value="W">Furniture</option> <option value="X">Misc. Functional</option> <option value="Y">Misc. Fashion</option></select></td>
</tr>
<tr>
<th>Image Extension:</th>
<td><input name="image" maxlength="4" value="." /></td>
</tr>
<tr>
<th>Is Bundle:</th>
<td style="padding: 2px; border: 1px solid #ccc;"><input type="checkbox" name="isbundle" onclick="switchBundle();" /></td>
</tr>
<tr class="bundle">
<th>Item 1 ID:</th>
<td><input name="item1_id" maxlength="8" /></td>
</tr>
<tr class="bundle">
<th>Item 1 Name:</th>
<td><input name="item1_name" maxlength="75" /></td>
</tr>
<tr class="bundle">
<th>Item 1 Count:</th>
<td><input name="item1_count" maxlength="4" /></td>
</tr>
<tr class="bundle">
<th>Item 2 ID:</th>
<td><input name="item2_id" maxlength="8" /></td>
</tr>
<tr class="bundle">
<th>Item 2 Name:</th>
<td><input name="item2_name" maxlength="75" /></td>
</tr>
<tr class="bundle">
<th>Item 2 Count:</th>
<td><input name="item2_count" maxlength="4" /></td>
</tr>
<tr class="bundle">
<th>Item 3 ID:</th>
<td><input name="item3_id" maxlength="8" /></td>
</tr>
<tr class="bundle">
<th>Item 3 Name:</th>
<td><input name="item3_name" maxlength="75" /></td>
</tr>
<tr class="bundle">
<th>Item 3 Count:</th>
<td><input name="item3_count" maxlength="4" /></td>
</tr>
<tr class="bundle">
<th>Item 4 ID:</th>
<td><input name="item4_id" maxlength="8" /></td>
</tr>
<tr class="bundle">
<th>Item 4 Name:</th>
<td><input name="item4_name" maxlength="75" /></td>
</tr>
<tr class="bundle">
<th>Item 4 Count:</th>
<td><input name="item4_count" maxlength="4" /></td>
</tr>
<tr>
<th>For Sale:</th>
<td style="padding: 2px; border: 1px solid #ccc;"><input type="checkbox" name="forsale" /></td>
</tr>
<tr>
<td colspan="2" style="border: 0;"><input type="submit" value="Edit Item" style="width: auto;" /></td>
</tr>
</table>
</form>
</p>
<p style="text-align: right;"><a href="javascript: goViewPage(<?php echo $_SESSION['panelpage'] ? $_SESSION['panelpage'] : 1 ;?>);">Back</a></p>
<?php
}
}
else {
$total_query = mssql_query("SELECT id FROM [{$mssql_db['webshop']}].dbo.PREMIUM_SHOP_TBL") ;
$total_pgs = mssql_num_rows($total_query) / $max_panel_list ;
$total_pages = roundUp($total_pgs) ;
if ($total_pages < 1)
$total_pages = 1 ;
if ($page > $total_pages)
$page = $total_pages ;
$pageMax = $page * $max_panel_list ;
$listArray = tableArray("SELECT TOP {$pageMax} * FROM [{$mssql_db['webshop']}].dbo.PREMIUM_SHOP_TBL") ;
$_SESSION['panelpage'] = $page ;
?>
<style>
table.panel-table tr td, table.panel-table tr th, table.panel-table tr th img {height: 35px; padding: 0; margin: 0; overflow: none;}
table.panel-table td, table.panel-table tr.panel-table-header th {padding: 2px; height: auto;}
th img {margin-top: 1px;}

#page_nav {width: 500px; height: 15px; padding: 0; text-align: center; margin: 2px auto;}
#page_nav a {color: #56585d; font-size: 13px; margin: auto 3px; font-weight: bold;}
#page_nav span {color:#5F87E1; font-size: 13px;}
</style>

<table style="width: 100%;" class="panel-table">
<tr class="panel-table-header">
<th>Image</th>
<th>Name</th>
<th style="width: 275px;">Description</th>
<th>Price</th>
<th>Options</th>
</tr>
<?php
for ( $i = $pageMax - $max_panel_list ; $i < count($listArray) ; $i++ ) {
?>
<tr<?php echo ( $i + 1 == count($listArray)) ? " class='last'" : "" ?>>
<th><img src="images/items/<?php echo $listArray[$i]['itemid'];echo $listArray[$i]['bundle'] ? "_bundle" : "" ;echo $listArray[$i]['image'];?>" /></th>
<td><?php echo $listArray[$i]['name'];?></td>
<td><?php echo ( strlen($listArray[$i]['desc']) > 40 ) ? substr($listArray[$i]['desc'], 0, 40) . "..." : $listArray[$i]['desc'];?></td>
<td><?php echo $listArray[$i]['price_sale'] ? $listArray[$i]['price_sale'] : $listArray[$i]['price'];echo " " . $cash_name_min ;?></td>
<td><a href="javascript: goPanelPage('modify&id=<?php echo $listArray[$i]['id'];?>');"><img src="images/management_edit.png" /></a> <a href="javascript: goPanelPage('delete&id=<?php echo $listArray[$i]['id'];?>');"><img src="images/management_delete.png" /></a></td>
</tr>
<?php
}
?>
</table>
<?php
echo '</div>' ;
echo '<p id="page_nav">' ;
echo page_list($total_pages, "goViewPage(") ;
echo '</p><div>' ;
}
}
?>
</div>
<?php
}
}
else {
include ("GetItemList.php") ;
}
?>
-----------------------------------------------
รบกวนช่วยน่อยครับ
จากคุณ : oat / kenu.ood@hotmail.com [2011-07-08 11:10:39]  

203.146.242.40 ความคิดเห็น #28417 (จาก IP: 203.146.242.40)
ตรวจสอบดังนี้
1.หน้าส่งและหน้ารับมี <meta http-equiv="Content-Type" content="text/html; charset=Windows-874"> แล้วหรือยัง

2.ฐานข้อมูลเลือก collection แบบใดไว้ http://mssqlbase.blogspot.com/2010/06/sql-server-database-collation.html
จากคุณ : maddog [2011-07-08 11:50:25]

183.89.200.221 ความคิดเห็น #28419 (จาก IP: 183.89.200.221)
ไม่ได้ครับเป็นเหมือนเดิม
จากคุณ : oat [2011-07-09 22:54:20]

183.89.200.221 ความคิดเห็น #28420 (จาก IP: 183.89.200.221)
โค๊ดเพิ่มเติมครับ
-----------------
<?php

require_once("inc/config.php");

if(stristr($_SERVER['PHP_SELF'], "functions.php"))
header("Location: ../");

session_start();

if (!$enable_shop)
die("<p style='text-align: center; color: #FF0000; padding-top: 30%; font-weight: bold'>The shop is currently unavailable.<br/>Please try again later.</p>");

$mssql_con = mssql_connect($mssql_server, $mssql_username, $mssql_password);
if (!$mssql_con)
die("Cannot connect to MSSQL Server.");

if (isset($_POST['user_id']))
{
session_destroy();
session_start();
}

$account = (isset($_SESSION['ifs_account'])) ? strtolower($_SESSION['ifs_account']) : strtolower($_POST['user_id']);
$player = (isset($_SESSION['ifs_player'])) ? $_SESSION['ifs_player'] : addZeroes($_POST['propid']);
$sindex = (isset($_SESSION['ifs_sindex'])) ? $_SESSION['ifs_sindex'] : "0".$_POST['server_index'];
$passwd = (isset($_SESSION['ifs_passwd'])) ? $_SESSION['ifs_passwd'] : $_POST['check'];

$accountcheck = $account ? true : false;

$account2 = $account;
$account = clean($account);

if (!isset($_SESSION['ifs_account']))
{
if ($accountcheck)
{
$account_query=mssql_query("SELECT * FROM [{$mssql_db['account']}].dbo.[chr_log_info] WHERE id_loginid = {$account}");
$account_row=mssql_fetch_array($account_query);
if (mssql_num_rows($account_query)) {
if ($account_row['id_passwd']==$passwd)
{
$character_query=mssql_query("SELECT * FROM [{$mssql_db['account']}].dbo.[chr_log_info] WHERE propid = $player");
$character_row=mssql_fetch_array($character_query);
if (mssql_num_rows($character_query))
{
$_SESSION['ifs_account'] = $_POST['account'];
$_SESSION['ifs_player'] = $character_row['propid'];
$_SESSION['ifs_passwd'] = $passwd;
}

}
else
header("Location: login.php?error=3");
}
else
header("Location: login.php?error=2");
}
else
header("Location: login.php?error=1");
}

$cash_query=mssql_query("SELECT * FROM [{$mssql_db['account']}].[dbo].[chr_log_info] WHERE id_loginid = {$account}");
$cash_row_array=mssql_fetch_array($cash_query);
$cash_count=$cash_row_array[$cash_row];

mssql_select_db($mssql_db['webshop']);

$page = (isset($_GET['page'])) ? clean(abs($_GET['page'])) : 1;
if ($page < 1) $page = 1;
$page_max = $page*$max_items;
$page_limit = $page_max-$max_items;

function clean($var)
{
if (is_int($var))
{
$var = $var;
}
else
if (is_array($var))
{
foreach($var as $key => $value)
{
$var[$key] = clean($value);
}
}
else
{
$unpacked = unpack('H*hex',$var);
$hex = '0x'.$unpacked['hex'];
$var = $hex;
}

return $var;
}

function addZeroes($num)
{
$max_len=7;
$cur_len=strlen($num);

while ($cur_len < $max_len)
{
$num="0".$num;
$cur_len++;
}

return $num;
}

function item_query($itemid)
{
global $popular;
switch($itemid)
{
case "popular":
if ($popular==0)
$item_query="SELECT TOP 1 * FROM PREMIUM_SHOP WHERE forsale = 1 ORDER BY purchases DESC";
else
$item_query="SELECT TOP 1 * FROM PREMIUM_SHOP WHERE id= {$popular} AND forsale = 1";
break;

default:
$item_query="SELECT TOP 1 * FROM PREMIUM_SHOP WHERE id = {$itemid} AND forsale = 1";
$item_result=mssql_query($item_query);
if(!mssql_num_rows($item_result))
$item_query="SELECT TOP 1 * FROM PREMIUM_SHOP WHERE forsale = 1 ORDER BY purchases DESC";
}

return $item_query;
}

function roundUp( $value, $precision=0 )
{
if ( $precision == 0 ) {
$precisionFactor = 1;
}
else {
$precisionFactor = pow( 10, $precision );
}
return ceil( $value * $precisionFactor )/$precisionFactor;
}

function br($text)
{
$text=str_replace("\\r\\n","<br />",$text);
$text=str_replace("\n","<br />",$text);
return $text;
}

function friends()
{
global $player, $sindex;
$stmt = mssql_init('shopMessengerList');

mssql_bind($stmt, '@pserverindex', $sindex, SQLCHAR);
mssql_bind($stmt, '@pPlayerID', $player, SQLCHAR);

$result = mssql_execute($stmt);

while ($row = mssql_fetch_assoc($result)) {
$return.= '<option value="'.$row['idFriend'].'">'.$row['m_szName'].'</option>';
}

mssql_free_statement($stmt);

return $return;
}

function updateCash($new_cash)
{
global $account, $cash_row, $mssql_db;
$new_cash = abs($new_cash);

$query = "UPDATE [{$mssql_db['account']}].[dbo].[chr_log_info] SET [{$cash_row}] = {$new_cash} WHERE id_loginid = {$account}";
$result=mssql_query($query);

if ($result)
return true;
else
return false;
}

function giftBundle($item1_id, $item1_name, $item1_count, $item2_id, $item2_name, $item2_count, $item3_id, $item3_name, $item3_count, $item4_id, $item4_name, $item4_count, $player)
{
global $sindex;

if ($item1_id&&$item1_name&&$item1_count)
$return = giftItem($item1_id, $item1_name, $item1_count, $player);

if ($item2_id&&$item2_name&&$item2_count&&$return)
$return = giftItem($item2_id, $item2_name, $item2_count, $player);

if ($item3_id&&$item3_name&&$item3_count&&$return)
$return = giftItem($item3_id, $item3_name, $item3_count, $player);

if ($item4_id&&$item4_name&&$item4_count&&$return)
$return = giftItem($item4_id, $item4_name, $item4_count, $player);

if (!isset($return))
$return = 0;

return $return;
}

function giftItem($itemid, $itemname, $itemcount, $player_to)
{
global $sindex, $player, $mssql_db;
mssql_select_db($mssql_db['webshop']);
$stmt = mssql_init('shopSendItem');

mssql_bind($stmt, '@propid', $player_to, SQLCHAR);
//mssql_bind($stmt, '@serverindex', $sindex, SQLCHAR);
//mssql_bind($stmt, '@item_name', $itemname, SQLTEXT);
mssql_bind($stmt, '@item_count', $itemcount, SQLINT1);
mssql_bind($stmt, '@item_id', $itemid, SQLINT1);
mssql_bind($stmt, '@m_idSender', $player, SQLCHAR);

$return = mssql_execute($stmt);

mssql_free_statement($stmt);

return $return;
}

function sendBundle($item1_id, $item1_name, $item1_count, $item2_id, $item2_name, $item2_count, $item3_id, $item3_name, $item3_count, $item4_id, $item4_name, $item4_count) {
global $player, $sindex;
mssql_select_db($mssql_db['webshop']);

if ($item1_id&&$item1_name&&$item1_count)
$return = sendItem($item1_id, $item1_name, $item1_count);

if ($item2_id&&$item2_name&&$item2_count&&$return)
$return = sendItem($item2_id, $item2_name, $item2_count);

if ($item3_id&&$item3_name&&$item3_count&&$return)
$return = sendItem($item3_id, $item3_name, $item3_count);

if ($item4_id&&$item4_name&&$item4_count&&$return)
$return = sendItem($item4_id, $item4_name, $item4_count);

if (!isset($return))
$return = 0;

return $return;
}

function sendItem($itemid, $itemname, $itemcount)
{
global $player, $sindex, $mssql_db;
mssql_select_db($mssql_db['webshop']);
$stmt = mssql_init('shopSendItem');

mssql_bind($stmt, '@propid', $player, SQLCHAR);
//mssql_bind($stmt, '@serverindex', $sindex, SQLCHAR);
//mssql_bind($stmt, '@item_name', $itemname, SQLTEXT);
mssql_bind($stmt, '@item_count', $itemcount, SQLINT1);
mssql_bind($stmt, '@item_id', $itemid, SQLINT1);

$return = mssql_execute($stmt);

mssql_free_statement($stmt);

return $return;
}

function PurchaseCount($itemid)
{
global $mssql_db;
if (is_int($itemid))
return mssql_query("UPDATE [{$mssql_db['webshop']}].dbo.[PREMIUM_SHOP] SET purchases = purchases + 1 WHERE id = {$itemid}");
}

function getLastID()
{
global $mssql_db;
$result = mssql_query("SELECT id FROM [{$mssql_db['webshop']}].dbo.[PREMIUM_SHOP] ORDER BY id DESC");
$row = mssql_fetch_array($result);
return $row['id'];
}

function tableArray($query)
{
$array = array();
$result = mssql_query($query);

for($i=0;$i<mssql_num_rows($result);$i++)
{
$mini_array = array();
for($n=0;$n<mssql_num_fields($result);$n++)
{
$field = mssql_field_name($result, $n);
$mini_array[$field] = mssql_result($result, $i, $field);
}

$array[$i] = $mini_array;
}

return $array;
}

function page_list($totalPages, $function)
{
global $max_list, $page;

$partial = ceil($max_list/2);

$cP = 1;
if ($page > $partial)
{
$cP = $page - $partial + 1;
}

if ($cP+$max_list > $totalPages+1)
{
while($cP+$max_list > $totalPages+1)
{
$cP--;
}
}

if ($cP < 1)
$cP = 1;

$prev = ($page - 1 > 0) ? $page - 1 : 1;
$next = ($page + 1 > $totalPages) ? $totalPages : $page + 1;

echo "<a href=\"javascript:{$function}1);\"><img src=\"../images/paper/prev_01.gif\"><a href=\"javascript:{$function}{$prev});\" ><img src=\"../images/paper/prev_02.gif\"></a> " ;
$i2 = 0 ;
for ( $i = $cP ; ($i2 < $max_list) && ($i <= $totalPages) ; $i++ ) {
echo ($i == $page) ? "<span>" : "<a href=\"javascript:{$function}{$i});\">" ;
echo $i ;
echo ($i == $page) ? "</span>" : "</a>" ;
echo " " ;
$i2++;
}
echo "<a href=\"javascript:{$function}{$next});\"><img src=\"../images/paper/next_02.gif\"><a href=\"javascript:{$function}{$totalPages});\"><img src=\"../images/paper/next_01.gif\"></a>" ;
}

function likeClean($str)
{
return preg_replace('/(?!\s)(\W)/', '', $str);
}

function fail($itemid = "popular", $giftflag = 1)
{
return '<script type="text/javascript">
$(document).ready(function() {
PurchaseFail('.$itemid.','.$giftflag.');
});
</script>';
}

function success($itemid, $giftflag = 1)
{
return '<script type="text/javascript">
$(document).ready(function() {
PurchaseSuccess('.$itemid.','.$giftflag.');
});
</script>';
}

function success2($itemid, $giftflag = 1)
{
return '<script type="text/javascript">
$(document).ready(function() {
PurchaseSuccess2('.$itemid.','.$giftflag.');
});
</script>';
}
?>
----------------------------
ขอบคุณครับ
จากคุณ : oat / kenu.ood@hotmail.com [2011-07-09 22:58:13]

125.24.175.224 ความคิดเห็น #28422 (จาก IP: 125.24.175.224)
เพื่อดูว่าเป็นที่โค้ดหรือเปล่า ให้สร้าง php มาใส่โค้ดแสดงผลข้อมูลจาก database อย่างเดียว ว่าปกติไหม๊

แล้วลองทำ php อีกหน้าใส่โค้ดที่สั่ง insert ภาษาไทยลง database แล้วก็เอามาแสดงผลว่าปกติไหม๊

ถ้าทั้งสองอย่างที่ทำแล้วแสดงภาษาไทยได้ปกติ แปลว่าเป็นที่โค้ดเจ้ากรรมของคุณใน php ไฟล์อื่นๆที่มีปัญหา

แต่หากทั้งสองอย่างไม่ปกติเช่นเดิม
ต้องลองเช็ค OS ว่ารองรับภาษาไทยหรือไม่ และกำหนด web serverถูกต้องหรือเปล่า รองรับ tis-620 หรือ windows-874 หรือไม่
จากคุณ : maddog [2011-07-09 23:52:21]
ตอบกระทู้
  • ห้ามการโฆษณา หากต้องการติดต่อหาลูกค้า ติดต่อโฆษณาโดยตรงได้ที่ webmaster@sourcecode.in.th
  • ห้ามใช้คำหยาบและคำพูดที่ไม่เหมาะสม
  • ขอสงวนสิทธิหากตรวจพบ ข้อความที่ไม่เหมาะสม ข้อความนั้นจะถูกลบทันที
ชื่อ
อีเมล์
รายละเอียด

- - - - - - - - - - - - - - ผู้ให้การสนับสนุน- - - - - - - - - - - - - -

 
 
คลิปสอนเขียนโปรแกรม
เรียนเขียนโปรแกรมดอทเน็ต
เรียนเขียนโปรแกรมแอนดรอยด์
เรียนเขียนโปรแกรมเบล็คเบอร์รี่
เรียนเขียนโปรแกรมซี ซีพลัสพลัส
เรียนเขียนโปรแกรมจาวา
เรียนการใช้งานลินุกส์
เรียนการเขียนโปรแกรมวินโดว์โฟน
เรียนการเขียนโปรแกรมพีเฮชพี มายเอสคิวเอล
อัตราค่าโฆษณา
 
Tutorial
eVB Tutorial
ASP.NET Webmatrix Tutorial
J2ME Tutorial
C++  Tutorial
Java  Tutorial
PHP Tutorial
ASP Tutorial
 
แบบสำรวจ

Home - Article - Tutorial - Sourcecode - Dev Handbook - Search - WebBoard - Links - About Us

สงวนลิขสิทธิ์ ห้ามคัดลอก ทำซ้ำ แก้ไข ดัดแปลง ไม่ว่าในรูปแบบใด โดยไม่ได้รับอนุญาตเป็นลายลักษณ์อักษร
เลขทะเบียนพาณิชย์อิเล็กทรอนิกส์จากกระทรวงพาณิชย์: 7100503002000
Copyright 2001 SourceCode.in.th