|
 |
|
พี่ๆช่วยดูโค้ดนี้ให้หน่อยค่ะ มันผิดตรงไหนหาไม่เจออ่ะค่ะ งมหานานแระอ่ะ |
|
 |
|
|
 |
 |
|
<?php
// ส่วนของการเพิ่ม ลบ แก้ไข ข้อมูล
if($_GET['method']=="insert"){
$dept_code=stripslashes($_POST['dept_code']);
$dept_name=stripslashes($_POST['dept_name']);
$dept_status=stripslashes($_POST['dept_status']);
if($dept_status!="Y"){ $dept_status="N"; }
if($dept_code!=""){
$oItem->table="tb_dept";
$oItem->data=array("dept_name","dept_status");
$oItem->value=array($dept_name,$dept_status);
$oItem->primarykey="dept_code";
$oItem->update($dept_code);
}else{
$oItem->table="tb_dept";
$oItem->primarykey="dept_code";
$dept_code= $oItem->getLastID();
if($dept_code!=""){ $dcount=(substr($dept_code,1,4)+1); }else{ $dcount="1"; }
$num=4-strlen($dcount);
for($i=1;$i<=$num;$i++){
$dcount="0".$dcount;
}
$dept_code = "N".$dcount;
$oItem->data=array("dept_code","dept_name","dept_status");
$oItem->value=array($dept_code,$dept_name,$dept_status);
$oItem->add();
}
}
if($_GET['method']=="delete"){
$dept_code=addslashes(stripslashes($_POST['id']));
$oItem->table="tb_dept";
$oItem->primarykey="dept_code";
$oItem->delete($dept_code);
exit;
}
if($_GET['method']=="getupdate"){
$dept_code=addslashes(stripslashes($_POST['id']));
$oItem->table="tb_dept";
$oItem->data=array("dept_code","dept_name","dept_status");
$oItem->primarykey="dept_code";
$result=$oItem->getDetail($dept_code);
$rs=mysql_fetch_array($result);
echo $rs['dept_code']."|";
echo $rs['dept_name']."|";
echo $rs['dept_status'];
exit;
}
?>
<?php
มันไม่มี error นะคะ แต่ว่ามันลบไม่ได้อ่ะค่ะ
ช่วยดูให้หน่อยนะคะ
ขอบคุณมากๆค่ะ....  
Tag : PHP, MySQL, Ajax, jQuery, WebService

|
|
 |
 |
 |
 |
Date :
2011-01-27 15:41:26 |
By :
50285452 |
View :
708 |
Reply :
2 |
|
 |
 |
 |
 |
|
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
ส่งค่ามาจากหน้าอื่นหรือเปล่าครับ
if($_GET['method']=="delete"){
$dept_code=addslashes(stripslashes($_POST['id'])); // ดูค่าตรงนี้ครับ
$oItem->table="tb_dept";
$oItem->primarykey="dept_code";
$oItem->delete($dept_code);
exit;
}
|
 |
 |
 |
 |
Date :
2011-01-27 15:49:45 |
By :
ไวยวิทย์ |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
ขอบคุณค่ะพี่
เริ่มจะนิดๆละ...
|
 |
 |
 |
 |
Date :
2011-01-27 16:43:44 |
By :
50285452 |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
|
|
|

|
Load balance : Server 02
|