 |
|
คือผมดึงขอมูลมาแสดงแล้วแล้วทำปุ่มลบ พอกดปุ่มลบแล้วมันไม่ลบอะพี่ ช่วยผมที่ผมนั้งหาวิธีตั้งแต่ 5 โมงเย็นตอนนี้ยังหาไม่ได้เลย
ด้านล่างนี้ตัวโค้ดครับ
หน้า index.php หน้าโชข้อมูลจาก db
Code (PHP)
<htrml>
<title>Bodindecha 4 Admin</title>
<head>
<META http-equiv="Content-Type" content="text/html; charset=tis-620" >
<style type="text/css">
<!--
body {
font : 0.9em verdana,geneva, Arial, helvetica, sans-serif;
background-color: #fff;
background-position:center;
color: #000000;
background-image: url();
background-repeat:no-repeat
}
</style>
</head>
<body>
<table width="100%" border="1" cellspacing="1" cellpadding="1">
<tr>
<td align="center" bgcolor="#e1e1e1"><b>ลำดับ</b></td>
<td align="center" bgcolor="#e1e1e1"><b>รหัสนักเรียน</b></td>
<td align="center" bgcolor="#e1e1e1"><b>ชื่อ</b></td>
<td align="center" bgcolor="#e1e1e1"><b>นามสกุล</b></td>
<td bgcolor="#e1e1e1"><b>ลบ</b></td>
</tr>
<?
include("dbconfig.php");
$result = mysql_query("select id,name,song,singer from resong order by id");
mysql_query('SET CHARACTER SET tis620');
while ($r=mysql_fetch_array($result)){
$id=$r[id];
$name=$r[name];
$song=$r[song];
$singer=$r[singer];
echo "
<tr>
<td>$id</td>
<td>$name</td>
<td>$song</td>
<td>$singer</td>
<td><a href='delete.php?resong=$id'
onclick=\"return confirm('คุณแน่นใจหรือไม่ ?')\">ลบ</a></td>
</tr>";
$number++;
}
?>
</table>
</body>
</html>
delete.php
Code (PHP)
<htrml>
<title>ลบข้อมูล</title>
<head>
<META http-equiv="Content-Type" content="text/html; charset=tis-620">
</head>
<body>
<?
$resong=$_GET['resong'];
include "dbconfig.php";
$sql="delete from resong where id=$resong";
mysql_db_query($dbname,$sql);
echo "<h2><a href='show.php'>ลบข้อมูลเรียบร้อยแล้วครับ</a></h2>";
?>
</body>
</html>
วอนพี่ๆทั้งหลายช่วยที่นะครับ... ผมพึ่งหัดภาษา PHP
Tag : PHP, MySQL, JavaScript, Ajax, CakePHP
|
|
 |
 |
 |
 |
Date :
2011-04-07 00:04:31 |
By :
thannam001 |
View :
801 |
Reply :
8 |
|
 |
 |
 |
 |
|
|
|
 |