|
|
|
รบกวนช่วยดูคำสั่ง Delete ให้ทีค๊า ... มันลบไม่ได้ซะงั้นค่ะ คำสั่งเชื่อมต่อฐานข้อมูลที่ได้ทำการสร้างไว้แล้ว |
|
|
|
|
|
|
|
... มันลบไม่ได้ซะงั้นค่ะ
Code (PHP)
<?
include("config.php"); // คำสั่งเชื่อมต่อฐานข้อมูลที่ได้ทำการสร้างไว้แล้ว
?>
<html><!-- InstanceBegin template="/Templates/new1.dwt" codeOutsideHTMLIsLocked="false" -->
<head>
<!-- InstanceBeginEditable name="doctitle" -->
<title>:::: Material System Mahasarakham University ::::</title>
<!-- InstanceEndEditable -->
<meta http-equiv="Content-Type" content="text/html; charset=windows-874">
<style type="text/css">
<!--
input{
font-family: Tahoma, Verdana, "MS Sans Serif";
font-size: 12px;
}
body,td,th {
font-family: Tahoma, Verdana, "MS Sans Serif";
font-size: 12px;
margin-bottom:0px;
}
a:link {
color: #0066CC;
text-decoration: none;
}
a:visited {
text-decoration: none;
color: #0066CC;
}
a:hover {
text-decoration: underline;
color: #FF9900;
}
a:active {
text-decoration: none;
color:#0066CC;
}
h1,h2,h3,h4,h5,h6 {
font-family: Tahoma, Verdana, "MS Sans Serif";
}
-->
</style>
<!-- InstanceBeginEditable name="head" --><!-- InstanceEndEditable -->
</head>
<body bgcolor="#FFFFFF" leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">
<!-- Save for Web Slices (new1.psd) -->
<table width="760" border="0" align="center" cellpadding="0" cellspacing="0" height="100%" style="border:1px; border-style:solid; border-color:#000000;">
<tr >
<td height="184" ><table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td width="206" rowspan="3"><img src="images/pic_material_01.jpg" width="206" height="184"></td>
<td height="100"><img src="images/pic_material_02.jpg" width="554" height="100"></td>
</tr>
<tr>
<td>
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td><img src="images/pic_material_03.jpg" width="37" height="27"></td>
<td><a href="index.html"><img src="images/pic_material_04.jpg" width="82" height="27" border="0"></a></td>
<td><a href="insertproduct.php"><img src="images/pic_material_05.jpg" width="108" height="27" border="0"></a></td>
<td><a href="insertcomplete.php"><img src="images/pic_material_08.jpg" width="143" height="27" border="0"></a></td>
<td><a href="borrow.php"><img src="images/pic_material_07.jpg" width="77" height="27" border="0"></a></td>
<td><a href="back.php"><img src="images/pic_material_09.jpg" width="47" height="27" border="0"></a></td>
<td><a href="searchproduct.php"><img src="images/pic_material_06.jpg" width="60" height="27" border="0"></a></td>
</tr>
</table></td>
</tr>
<tr>
<td height="57" background="images/pic_material_10.jpg"> </td>
</tr>
</table></td>
</tr>
<tr height="100%">
<td height="100%" background="images/new1_02.jpg" align="center" valign="top"><!-- InstanceBeginEditable name="body" -->
<table width="750" height="96" border="0" cellpadding="0" cellspacing="1">
<?
if($_POST[hddCtrl]=="OK" && $_POST[hddid]!="") // ลบข้อมูล
{
?>
<tr>
<td height="80" colspan="13" align="center" valign="middle">
<?
$sql_show_pic="select * from material where id=$m_id ";
//$sql_delete="delete from material where m_id='$Request[m_id]' ";
$query_show_pic=mysql_query($sql_show_pic);
$result_show_pic=mysql_fetch_array($query_show_pic);
//$sql_delete="delete from material where id='$_POST[hddid]' ";
$sql_delete="delete from material where m_id=$m_id ";
$paths="img_product/".$result_show_pic[pic];
if(mysql_query($sql_delete) && unlink($paths))
{
echo"<Font Size=4><B>ลบข้อมูลเรียบร้อยแล้วค่ะ</B>";
}
else
{
echo"<Font Size=4><B>ไม่สามารถลบได้ค่ะ</B>";
}
?></td>
</tr>
<?
}
?>
<tr>
<td height="25" colspan="13"><strong> :: รายการสินค้าทั้งหมด</strong></td>
</tr>
<tr>
<td width="17"> </td>
<td width="62"> </td>
<td width="44"> </td>
<td width="31"> </td>
<td width="89"> </td>
<td width="39"> </td>
<td width="29"> </td>
<td width="70"> </td>
<td width="80"> </td>
<td width="80"> </td>
<td width="108"> </td>
<td width="39"> </td>
<td width="48"> </td>
</tr>
<tr bgcolor="#FF9933">
<td align="center" bgcolor="#FF9933"><strong>ที่</strong></td>
<td align="center" bgcolor="#FF9933"><strong>ชื่อวัสดุ</strong></td>
<td align="center" bgcolor="#FF9933"><strong>จำนวน</strong></td>
<td align="center" bgcolor="#FF9933"><strong>ยี่ห้อ</strong></td>
<td align="center" bgcolor="#FF9933"><strong>สถานที่เก็บ</strong></td>
<td align="center" bgcolor="#FF9933"><strong>ผู้ดูแล</strong></td>
<td align="center" bgcolor="#FF9933"><strong>ปี</strong></td>
<td align="center" bgcolor="#FF9933"><strong>วันที่</strong></td>
<td align="center" bgcolor="#FF9933"><strong>รูปภาพ</strong></td>
<td align="center" bgcolor="#FF9933"><strong>บริษัท</strong></td>
<td align="center" bgcolor="#FF9933"><strong>รายละเอียดเพิ่มเติม</strong></td>
<td colspan="2" align="center" bgcolor="#FFFFFF"><form name="form3" method="post" action="insertproduct.php">
<input type="submit" name="button3" id="button3" value=" เพิ่มข้อมูล">
</form> </td>
</tr>
<?
$sql_show="select * from material ";
$query_show=mysql_query($sql_show);
$i=1;
while($result_show=mysql_fetch_array($query_show))
{
?>
<tr bgcolor="#6666CC" style="cursor:hand; " >
<td align="center" valign="top" bgcolor="#CCCCCC"><a href="test_borrow.php?mid=<?=$result_show[m_id]?>">
<?=$i?>
</a></td>
<td align="left" valign="top" bgcolor="#CCCCCC"><a href="test_borrow.php?mid=<?=$result_show[m_id]?>">
<?=$result_show[name]?>
</a></td>
<td align="center" valign="top" bgcolor="#CCCCCC"><a href="test_borrow.php?mid=<?=$result_show[m_id]?>">
<?=$result_show[amount]?>
</a></td>
<td align="center" valign="top" bgcolor="#CCCCCC"><a href="test_borrow.php?mid=<?=$result_show[m_id]?>">
<?=$result_show[brand]?>
</a></td>
<td align="left" valign="top" bgcolor="#CCCCCC"><a href="test_borrow.php?mid=<?=$result_show[m_id]?>">
<?=$result_show[location]?>
</a></td>
<td align="center" valign="top" bgcolor="#CCCCCC"><a href="test_borrow.php?mid=<?=$result_show[m_id]?>">
<?=$result_show[resposible]?>
</a></td>
<td align="center" valign="top" bgcolor="#CCCCCC"><a href="test_borrow.php?mid=<?=$result_show[m_id]?>">
<?=$result_show[year_budget]?>
</a></td>
<td align="center" valign="top" bgcolor="#CCCCCC"><a href="test_borrow.php?mid=<?=$result_show[m_id]?>">
<?
$yu=substr($result_show[date_purchase],0,4);
$mu=substr($result_show[date_purchase],5,2);
$du=substr($result_show[date_purchase],8,2);
echo $du."/".$mu."/".($yu+543);
?>
</a></td>
<td align="center" valign="middle" bgcolor="#CCCCCC"><a href="test_borrow.php?mid=<?=$result_show[m_id]?>"><img src="img_product/<?=$result_show[pic]?>" alt="" width="80" border="0"></a></td>
<td align="center" valign="top" bgcolor="#CCCCCC"><a href="test_borrow.php?mid=<?=$result_show[m_id]?>">
<?=$result_show[company]?>
</a></td>
<td align="left" valign="top" bgcolor="#CCCCCC"><a href="test_borrow.php?mid=<?=$result_show[m_id]?>">
<?=$result_show[detail]?>
</a></td>
<td align="center" valign="top" bgcolor="#CCCCCC"><form name="form1" method="post" action="">
<input type="submit" name="button" id="button" value="ลบ">
<br>
<input name="hddCtrl" type="hidden" id="hddCtrl" value="<?="OK"?>">
<input name="hddid2" type="hidden" id="hddid2" value="<?=$result_show[m_id]?>">
</form> </td>
<td align="center" valign="top" bgcolor="#CCCCCC"><form name="form2" method="post" action="update_product.php">
<input type="submit" name="button2" id="button2" value="แก้ไข">
<input name="hddid" type="hidden" id="hddid" value="<?=$result_show[m_id]?>">
</form> </td>
</tr>
<?
$i++;
}
?>
<tr>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
<td> </td>
</tr>
</table>
<!-- InstanceEndEditable --></td>
</tr>
<tr>
<td height="61"><img src="images/new1_05.jpg" width="760" height="61"></td>
</tr>
</table>
<!-- End Save for Web Slices -->
</body>
<!-- InstanceEnd --></html>
Tag : - - - -
|
|
|
|
|
|
Date :
2010-07-21 08:32:01 |
By :
cyber_girls_198 |
View :
1221 |
Reply :
4 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Code (PHP)
$sql_delete="delete from material where m_id='$m_id' ";
แก้เป็นแบบนี้นะครับ
|
|
|
|
|
Date :
2010-07-21 08:34:28 |
By :
SOUL |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ค่า $m_id มาจากไหนอ่ะครับ ไม่เห็นมีการส่งค่าเลย
|
|
|
|
|
Date :
2010-07-21 08:41:23 |
By :
onizike |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
$sql_delete="delete from material where m_id=$m_id "
มันมีเว้นวรรคอยู่ คำสั่งเพี้ยนนะ
|
|
|
|
|
Date :
2010-07-21 08:45:56 |
By :
50121680 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
ได้แล้วค่าาา ขอบคุณมากเลยค่ะ
|
|
|
|
|
Date :
2010-07-21 08:51:20 |
By :
cyber_girls_198 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Load balance : Server 04
|