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,027

HOME > PHP > PHP Forum > ถามเกี่ยวกับ php หน่อยครับพอดีติดปัญหา ขอความกรุณาด้วยครับ



 

ถามเกี่ยวกับ php หน่อยครับพอดีติดปัญหา ขอความกรุณาด้วยครับ

 



Topic : 047487

Guest




คือว่าผมเขียนเสร็จแล้ว แต่ปุ่ม edit กับ delete มันไม่ทำงานอะครับแบบว่ากดได้ แต่มันไม่ยอมลบ ข้อมูลออกจากดาต้าเบส กด edit ก็กลายเป็นสร้างใหม่ซะงั้น

ข้างล่างนี่ โค้ดอะครับ ไม่รู่ว่ามันผิดตรงใหน ^^' ช่วยดูให้ทีครับ
Quote:
<?php require_once('Connections/j-book.php'); ?>
<?php
// Load the common classes
require_once('includes/common/KT_common.php');

// Load the required classes
require_once('includes/tfi/TFI.php');
require_once('includes/tso/TSO.php');
require_once('includes/nav/NAV.php');

// Make unified connection variable
$conn_jbook = new KT_connection($jbook, $database_jbook);

if (!function_exists("GetSQLValueString")) {
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
{
$theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;

$theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);

switch ($theType) {
case "text":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "long":
case "int":
$theValue = ($theValue != "") ? intval($theValue) : "NULL";
break;
case "double":
$theValue = ($theValue != "") ? "'" . doubleval($theValue) . "'" : "NULL";
break;
case "date":
$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
break;
case "defined":
$theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
break;
}
return $theValue;
}
}

// Filter
$tfi_listcontent1 = new TFI_TableFilter($conn_jbook, "tfi_listcontent1");
$tfi_listcontent1->addColumn("content.NAME", "STRING_TYPE", "NAME", "%");
$tfi_listcontent1->addColumn("publishing_id.PUBLISHING_ID", "NUMERIC_TYPE", "PUBLISHING_ID", "=");
$tfi_listcontent1->addColumn("type_id.TYPE_ID", "NUMERIC_TYPE", "TYPE_ID", "=");
$tfi_listcontent1->addColumn("content.VOL", "STRING_TYPE", "VOL", "%");
$tfi_listcontent1->addColumn("content.DATE", "STRING_TYPE", "DATE", "%");
$tfi_listcontent1->addColumn("content.NEXT", "STRING_TYPE", "NEXT", "%");
$tfi_listcontent1->Execute();

// Sorter
$tso_listcontent1 = new TSO_TableSorter("rscontent1", "tso_listcontent1");
$tso_listcontent1->addColumn("content.NAME");
$tso_listcontent1->addColumn("publishing_id.PUBLISHING_NAME");
$tso_listcontent1->addColumn("type_id.TYPE_NAME");
$tso_listcontent1->addColumn("content.VOL");
$tso_listcontent1->addColumn("content.DATE");
$tso_listcontent1->addColumn("content.NEXT");
$tso_listcontent1->setDefault("content.NAME");
$tso_listcontent1->Execute();

// Navigation
$nav_listcontent1 = new NAV_Regular("nav_listcontent1", "rscontent1", "", $_SERVER['PHP_SELF'], 60);

mysql_select_db($database_jbook, $jbook);
$query_Recordset1 = "SELECT PUBLISHING_NAME, PUBLISHING_ID FROM publishing_id ORDER BY PUBLISHING_NAME";
$Recordset1 = mysql_query($query_Recordset1, $jbook) or die(mysql_error());
$row_Recordset1 = mysql_fetch_assoc($Recordset1);
$totalRows_Recordset1 = mysql_num_rows($Recordset1);

mysql_select_db($database_jbook, $jbook);
$query_Recordset2 = "SELECT TYPE_NAME, TYPE_ID FROM type_id ORDER BY TYPE_NAME";
$Recordset2 = mysql_query($query_Recordset2, $jbook) or die(mysql_error());
$row_Recordset2 = mysql_fetch_assoc($Recordset2);
$totalRows_Recordset2 = mysql_num_rows($Recordset2);

//NeXTenesio3 Special List Recordset
$maxRows_rscontent1 = $_SESSION['max_rows_nav_listcontent1'];
$pageNum_rscontent1 = 0;
if (isset($_GET['pageNum_rscontent1'])) {
$pageNum_rscontent1 = $_GET['pageNum_rscontent1'];
}
$startRow_rscontent1 = $pageNum_rscontent1 * $maxRows_rscontent1;

// Defining List Recordset variable
$NXTFilter_rscontent1 = "1=1";
if (isset($_SESSION['filter_tfi_listcontent1'])) {
$NXTFilter_rscontent1 = $_SESSION['filter_tfi_listcontent1'];
}
// Defining List Recordset variable
$NXTSort_rscontent1 = "content.NAME";
if (isset($_SESSION['sorter_tso_listcontent1'])) {
$NXTSort_rscontent1 = $_SESSION['sorter_tso_listcontent1'];
}
mysql_select_db($database_jbook, $jbook);

$query_rscontent1 = "SELECT content.NAME, publishing_id.PUBLISHING_NAME AS PUBLISHING_ID, type_id.TYPE_NAME AS TYPE_ID, content.VOL, content.DATE, content.NEXT, content.id FROM (content LEFT JOIN publishing_id ON content.PUBLISHING_ID = publishing_id.PUBLISHING_ID) LEFT JOIN type_id ON content.TYPE_ID = type_id.TYPE_ID WHERE {$NXTFilter_rscontent1} ORDER BY {$NXTSort_rscontent1}";
$query_limit_rscontent1 = sprintf("%s LIMIT %d, %d", $query_rscontent1, $startRow_rscontent1, $maxRows_rscontent1);
$rscontent1 = mysql_query($query_limit_rscontent1, $jbook) or die(mysql_error());
$row_rscontent1 = mysql_fetch_assoc($rscontent1);

if (isset($_GET['totalRows_rscontent1'])) {
$totalRows_rscontent1 = $_GET['totalRows_rscontent1'];
} else {
$all_rscontent1 = mysql_query($query_rscontent1);
$totalRows_rscontent1 = mysql_num_rows($all_rscontent1);
}
$totalPages_rscontent1 = ceil($totalRows_rscontent1/$maxRows_rscontent1)-1;
//End NeXTenesio3 Special List Recordset

$nav_listcontent1->checkBoundries();
?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd External Link">
<html xmlns="http://www.w3.org/1999/xhtml External Link">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>BOOK</title><link href="includes/skins/mxkollection3.css" rel="stylesheet" type="text/css" media="all" /><script src="includes/common/js/base.js" type="text/javascript"></script><script src="includes/common/js/utility.js" type="text/javascript"></script><script src="includes/skins/style.js" type="text/javascript"></script><script src="includes/nxt/scripts/list.js" type="text/javascript"></script><script src="includes/nxt/scripts/list.js.php" type="text/javascript"></script><script type="text/javascript">
$NXT_LIST_SETTINGS = {
duplicate_buttons: false,
duplicate_navigation: false,
row_effects: true,
show_as_buttons: false,
record_counter: true
}
</script><style type="text/css">
/* Dynamic List row settings */
.KT_col_NAME {width:290px; overflow:hidden;}
.KT_col_PUBLISHING_ID {width:80px; overflow:hidden;}
.KT_col_TYPE_ID {width:60px; overflow:hidden;}
.KT_col_VOL {width:20px; overflow:hidden;}
.KT_col_DATE {width:70px; overflow:hidden;}
.KT_col_NEXT {width:80px; overflow:hidden;}
</style>

</head>

<body>
<?php include("menu.php"); ?>
<div class="KT_tng" id="listcontent1">
<h1> BOOK
<?php
$nav_listcontent1->Prepare();
require("includes/nav/NAV_Text_Statistics.inc.php");
?>
</h1>
<div class="KT_tnglist">
<form action="<?php echo KT_escapeAttribute(KT_getFullUri()); ?>" method="post" id="form1">
<div class="KT_options"> <a href="<?php echo $nav_listcontent1->getShowAllLink(); ?>"><?php echo NXT_getResource("Show"); ?>
<?php
// Show IF Conditional region1
if (@$_GET['show_all_nav_listcontent1'] == 1) {
?>
<?php echo $_SESSION['default_max_rows_nav_listcontent1']; ?>
<?php
// else Conditional region1
} else { ?>
<?php echo NXT_getResource("all"); ?>
<?php }
// endif Conditional region1
?>
<?php echo NXT_getResource("records"); ?></a> &nbsp;
&nbsp;
<?php
// Show IF Conditional region2
if (@$_SESSION['has_filter_tfi_listcontent1'] == 1) {
?>
<a href="<?php echo $tfi_listcontent1->getResetFilterLink(); ?>"><?php echo NXT_getResource("Reset filter"); ?></a>
<?php
// else Conditional region2
} else { ?>
<a href="<?php echo $tfi_listcontent1->getShowFilterLink(); ?>"><?php echo NXT_getResource("Show filter"); ?></a>
<?php }
// endif Conditional region2
?>
</div>
<table cellpadding="2" cellspacing="0" class="KT_tngtable">
<thead>
<tr class="KT_row_order">
<th> <input type="checkbox" name="KT_selAll" id="KT_selAll"/>
</th>
<th id="NAME" class="KT_sorter KT_col_NAME <?php echo $tso_listcontent1->getSortIcon('content.NAME'); ?>"> <a href="<?php echo $tso_listcontent1->getSortLink('content.NAME'); ?>">BOOK NAME</a> </th>
<th id="PUBLISHING_ID" class="KT_sorter KT_col_PUBLISHING_ID <?php echo $tso_listcontent1->getSortIcon('publishing_id.PUBLISHING_NAME'); ?>"> <a href="<?php echo $tso_listcontent1->getSortLink('publishing_id.PUBLISHING_NAME'); ?>">PUBLISHING</a> </th>
<th id="TYPE_ID" class="KT_sorter KT_col_TYPE_ID <?php echo $tso_listcontent1->getSortIcon('type_id.TYPE_NAME'); ?>"> <a href="<?php echo $tso_listcontent1->getSortLink('type_id.TYPE_NAME'); ?>">TYPE</a> </th>
<th id="VOL" class="KT_sorter KT_col_VOL <?php echo $tso_listcontent1->getSortIcon('content.VOL'); ?>"> <a href="<?php echo $tso_listcontent1->getSortLink('content.VOL'); ?>">VOL</a> </th>
<th id="DATE" class="KT_sorter KT_col_DATE <?php echo $tso_listcontent1->getSortIcon('content.DATE'); ?>"> <a href="<?php echo $tso_listcontent1->getSortLink('content.DATE'); ?>">DATE</a> </th>
<th id="NEXT" class="KT_sorter KT_col_NEXT <?php echo $tso_listcontent1->getSortIcon('content.NEXT'); ?>"> <a href="<?php echo $tso_listcontent1->getSortLink('content.NEXT'); ?>">NEXT</a> </th>
<th>&nbsp;</th>
</tr>
<?php
// Show IF Conditional region3
if (@$_SESSION['has_filter_tfi_listcontent1'] == 1) {
?>
<tr class="KT_row_filter">
<td>&nbsp;</td>
<td><input type="text" name="tfi_listcontent1_NAME" id="tfi_listcontent1_NAME" value="<?php echo KT_escapeAttribute(@$_SESSION['tfi_listcontent1_NAME']); ?>" size="35" maxlength="255" /></td>
<td><select name="tfi_listcontent1_PUBLISHING_ID" id="tfi_listcontent1_PUBLISHING_ID">
<option value="" <?php if (!(strcmp("", @$_SESSION['tfi_listcontent1_PUBLISHING_ID']))) {echo "SELECTED";} ?>><?php echo NXT_getResource("None"); ?></option>
<?php
do {
?>
<option value="<?php echo $row_Recordset1['PUBLISHING_ID']?>"<?php if (!(strcmp($row_Recordset1['PUBLISHING_ID'], @$_SESSION['tfi_listcontent1_PUBLISHING_ID']))) {echo "SELECTED";} ?>><?php echo $row_Recordset1['PUBLISHING_NAME']?></option>
<?php
} while ($row_Recordset1 = mysql_fetch_assoc($Recordset1));
$rows = mysql_num_rows($Recordset1);
if($rows > 0) {
mysql_data_seek($Recordset1, 0);
$row_Recordset1 = mysql_fetch_assoc($Recordset1);
}
?>
</select>
</td>
<td><select name="tfi_listcontent1_TYPE_ID" id="tfi_listcontent1_TYPE_ID">
<option value="" <?php if (!(strcmp("", @$_SESSION['tfi_listcontent1_TYPE_ID']))) {echo "SELECTED";} ?>><?php echo NXT_getResource("None"); ?></option>
<?php
do {
?>
<option value="<?php echo $row_Recordset2['TYPE_ID']?>"<?php if (!(strcmp($row_Recordset2['TYPE_ID'], @$_SESSION['tfi_listcontent1_TYPE_ID']))) {echo "SELECTED";} ?>><?php echo $row_Recordset2['TYPE_NAME']?></option>
<?php
} while ($row_Recordset2 = mysql_fetch_assoc($Recordset2));
$rows = mysql_num_rows($Recordset2);
if($rows > 0) {
mysql_data_seek($Recordset2, 0);
$row_Recordset2 = mysql_fetch_assoc($Recordset2);
}
?>
</select>
</td>
<td><input type="text" name="tfi_listcontent1_VOL" id="tfi_listcontent1_VOL" value="<?php echo KT_escapeAttribute(@$_SESSION['tfi_listcontent1_VOL']); ?>" size="20" maxlength="255" /></td>
<td><input type="text" name="tfi_listcontent1_DATE" id="tfi_listcontent1_DATE" value="<?php echo KT_escapeAttribute(@$_SESSION['tfi_listcontent1_DATE']); ?>" size="20" maxlength="255" /></td>
<td><input type="text" name="tfi_listcontent1_NEXT" id="tfi_listcontent1_NEXT" value="<?php echo KT_escapeAttribute(@$_SESSION['tfi_listcontent1_NEXT']); ?>" size="20" maxlength="100" /></td>
<td><input type="submit" name="tfi_listcontent1" value="<?php echo NXT_getResource("Filter"); ?>" /></td>
</tr>
<?php }
// endif Conditional region3
?>
</thead>
<tbody>
<?php if ($totalRows_rscontent1 == 0) { // Show if recordset empty ?>
<tr>
<td colspan="10"><?php echo NXT_getResource("The table is empty or the filter you've selected is too restrictive."); ?></td>
</tr>
<?php } // Show if recordset empty ?>
<?php if ($totalRows_rscontent1 > 0) { // Show if recordset not empty ?>
<?php do { ?>
<tr class="<?php echo @$cnt1++%2==0 ? "" : "KT_even"; ?>">
<td><input type="checkbox" name="kt_pk_content" class="id_checkbox" value="<?php echo $row_rscontent1['ID']; ?>" />
<input type="hidden" name="ID" class="id_field" value="<?php echo $row_rscontent1['ID']; ?>" />
</td>
<td><div class="KT_col_NAME"><?php echo KT_FormatForList($row_rscontent1['NAME'], 150); ?></div></td>
<td><div class="KT_col_PUBLISHING_ID"><?php echo KT_FormatForList($row_rscontent1['PUBLISHING_ID'], 30); ?></div></td>
<td><div class="KT_col_TYPE_ID"><?php echo KT_FormatForList($row_rscontent1['TYPE_ID'], 30); ?></div></td>
<td><div class="KT_col_VOL"><?php echo KT_FormatForList($row_rscontent1['VOL'], 20); ?></div></td>
<td><div class="KT_col_DATE"><?php echo KT_FormatForList($row_rscontent1['DATE'], 20); ?></div></td>
<td><div class="KT_col_NEXT"><?php echo KT_FormatForList($row_rscontent1['NEXT'], 100); ?></div></td>
<td><a class="KT_edit_link" href="contentform.php?ID=<?php echo $row_rscontent1['ID']; ?>&amp;KT_back=1"><?php echo NXT_getResource("edit_one"); ?></a> <a class="KT_delete_link" href="#delete"><?php echo NXT_getResource("delete_one"); ?></a> </td>
</tr>
<?php } while ($row_rscontent1 = mysql_fetch_assoc($rscontent1)); ?>
<?php } // Show if recordset not empty ?>
</tbody>
</table>
<div class="KT_bottomnav">
<div>
<?php
$nav_listcontent1->Prepare();
require("includes/nav/NAV_Text_Navigation.inc.php");
?>
</div>
</div>
<div class="KT_bottombuttons">
<div class="KT_operations"> <a class="KT_edit_op_link" href="#" onclick="nxt_list_edit_link_form(this); return false;"><?php echo NXT_getResource("edit_all"); ?></a> <a class="KT_delete_op_link" href="#" onclick="nxt_list_delete_link_form(this); return false;"><?php echo NXT_getResource("delete_all"); ?></a> </div>
<span>&nbsp;</span>
<select name="no_new" id="no_new">
<option value="1">1</option>
<option value="3">3</option>
<option value="6">6</option>
</select>
<a class="KT_additem_op_link" href="contentform.php?KT_back=1" onclick="return nxt_list_additem(this)"><?php echo NXT_getResource("add new"); ?></a> </div>
</form>
</div>
<br class="clearfixplain" />
</div>
<div align="justify">
<?php print date("l j F Y") ?>
</div>
<p>&nbsp;</p>
</body>
</html>
<?php
mysql_free_result($Recordset1);

mysql_free_result($Recordset2);

mysql_free_result($rscontent1);
?>




Tag : PHP







Move To Hilight (Stock) 
Send To Friend.Bookmark.
Date : 2010-08-22 22:32:25 By : อากิ View : 625 Reply : 2
 

 

No. 1



โพสกระทู้ ( 11,835 )
บทความ ( 10 )

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

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


ขอผ่านครับ ตาลาย มึนโค๊ด รอท่านอื่นต่อไป จะให้ดี เปลี่ยนจาก quote เป็น php code ดีกว่านะครับ






แสดงความคิดเห็นโดยอ้างถึง ความคิดเห็นนี้
Date : 2010-08-22 22:37:00 By : PlaKriM
 


 

No. 2

Guest


แก้เองเจอแล้วครับ งมหาทั้งวัน ผิดกันแค่ id กับ ID แม่จ้าวผิดไปแค่เล้กกับใหญ่นิดเดียวจริงๆ
แสดงความคิดเห็นโดยอ้างถึง ความคิดเห็นนี้
Date : 2010-08-23 03:27:12 By : อากิ
 

   

ค้นหาข้อมูล


   
 

แสดงความคิดเห็น
Re : ถามเกี่ยวกับ php หน่อยครับพอดีติดปัญหา ขอความกรุณาด้วยครับ
 
 
รายละเอียด
 
ตัวหนา ตัวเอียง ตัวขีดเส้นใต้ ตัวมีขีดกลาง| ตัวเรืองแสง ตัวมีเงา ตัวอักษรวิ่ง| จัดย่อหน้าอิสระ จัดย่อหน้าชิดซ้าย จัดย่อหน้ากึ่งกลาง จัดย่อหน้าชิดขวา| เส้นขวาง| ขนาดตัวอักษร แบบตัวอักษร
ใส่แฟลช ใส่รูป ใส่ไฮเปอร์ลิ้งค์ ใส่อีเมล์ ใส่ลิ้งค์ 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 (หรือล็อกอินเข้าระบบสมาชิกเพื่อไม่ต้องกรอก)







Exchange: นำเข้าสินค้าจากจีน, Taobao, เฟอร์นิเจอร์, ของพรีเมี่ยม, ร่ม, ปากกา, power bank, แฟลชไดร์ฟ, กระบอกน้ำ

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