|
 |
|
ช่วยดูหน่อยครับ ต้องการ edit ข้อมูลในฐานข้อมูล เพียงตัวเดียว |
|
 |
|
|
 |
 |
|
ผมทำให้มันเปลี่ยนข้อมูลได้แล้วอะครับ แต่ มันเปลี่ยนได้แค่ ID แรก ID เดียวพอแก้ ID อื่นมันไม่มีอะไรเกิดขึ้นเลยครับ ช่วยหน่อย
|
 |
 |
 |
 |
Date :
2012-09-25 13:42:02 |
By :
Joiie |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
ลองเอาหน้านี้มาหมดเลยได้ไหมครับ
|
 |
 |
 |
 |
Date :
2012-09-25 13:54:57 |
By :
weaned |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
Code (PHP)
<?
$sql="select * from tb_question order by id_ques desc";
$result=mysql_db_query($dbname,$sql);
echo "
<h3><font size='2' face='MS Sans Serif'><a href='admin_page.php'>[กลับหน้าAdmin]</a><a href='logout1.php'>[ออกจากระบบ]</a></h3></font>
<h3><center> รายการการแจ้งซ่อม</h3>
<a href='guestion_form.htm'></a><p>
<table width='100%' border='1'>
<tr bgcolor='#D2E9FF'>
<td width='25%'><center><b><font size='2' face='MS Sans Serif'>หัวข้อคำถาม</font></b></center></td>
<td width='8%'><center><b><font size='2' face='MS Sans Serif'>บริษัท</font></b></center></td>
<td width='10%'><center><b><font size='2' face='MS Sans Serif'>ผู้แจ้งซ่อม</font></b></center></td>
<td width='10%'><center><b><font size='2' face='MS Sans Serif'>ประเภท</font></b></center></td>
<td width='10%'><center><b><font size='2' face='MS Sans Serif'>เเจ้งเมื่อวันที่</font></b></center></td>
<td width='10%'><center><b><font size='2' face='MS Sans Serif'>สถานะ</font></b></center></td>
<td width='5%'><center><b><font size='2' face='MS Sans Serif'>แก้ไขสถานะ</font></b></center></td>
<td width='5%'><center><b><font size='2' face='MS Sans Serif'>ลบสถานะ</font></b></center></td>
</tr>";
while($record=mysql_fetch_array($result)) {
$username=$record[username];
$title_ques=$record[title_ques];
$list_ques=$record[list_ques];
$detail_ques=$record[detail_ques];
$name_ques=$record[name_ques];
$email=$record[email];
$date_ques=$record[date_ques];
$id_ques=$record[id_ques];
$status=$record[status];
$company=$record[company];
$title_ques=htmlspecialchars($title_ques);
$name=htmlspecialchars($name);
$detail_ques=nl2br(htmlspecialchars($detail_ques));
$date_ques1=DateThai($date_ques);
$EDIT=$_GET['EDIT'];
$DEL=$_GET['DEL'];
$status1=$_POST['status1'];
if($id_ques == $EDIT )
{
echo"
<tr bgcolor='#FFFFFF'>
<td width='25%'> <a href='answer_view1.php?id_ques=$id_ques'>$title_ques</a></td>
<td width='8%'><center>$company</center></td>
<td width='10%'> <center>$name_ques</center></td>
<td width='10%'> <center>$list_ques</center></td>
<td width='10%'> <center>$date_ques1</center></td>";
?>
<form name="Main" method="post" action="question_view2.php">
<input type="hidden" name="id" value="<?=$id_ques?>">
<input type="hidden" name="hdnCmd" value="">
<td><select name="status1" id="select">
<option>ยังไม่ได้ดำเนินการ</option>
<option>กำลังดำเนินการ</option>
<option>แก้ไขไม่ได้</option>
<option>ดำเนินการแล้ว</option>
</select></td>
<td width='5%'><a href="question_view2.php" onClick="Main.hdnCmd.value='Update';Main.submit()">ตกลง</a>
</td>
<?
echo"
<td width='5%'><a href='question_view2.php'onclick=\"return \">ยกเลิก</a></td>";
}
else
{
echo"
<tr bgcolor='#FFFFFF'>
<td width='25%'> <a href='answer_view1.php?id_ques=$id_ques'>$title_ques</a></td>
<td width='8%'><center>$company</center></td>
<td width='10%'> <center>$name_ques</center></td>
<td width='10%'> <center>$list_ques</center></td>
<td width='10%'> <center>$date_ques1</center></td>
<td width='10%'><center>$status</center></td>
<td width='5%'><a href='question_view2.php?EDIT=$id_ques'>แก้ไข</a></td>
<td width='5%'><a href='question_view2.php?DEL=$id_ques'onclick=\"return confirm('คุณแน่ใจที่จะลบปัญหานี้ออกจากระบบ ?'),location.reload(true)\">ลบ</a></td>
</tr>";
}
}
echo" </table>";
$sql1="delete from tb_question where id_ques=$DEL";
$result1=mysql_db_query($dbname,$sql1);
if($_POST["hdnCmd"] == "Update" && $_POST["id"] == $id_ques){
$objDB = mysql_select_db("db_member");
$sql2 ="update tb_question set ";
$sql2 .="id_ques = '$id_ques',name_ques = '$name_ques',title_ques = '$title_ques', detail_ques = '$detail_ques',date_ques = '$date_ques',list_ques = '$list_ques',company = '$company',status = '$status1' where id_ques='".$_POST["id"]."'";
$objQuery=mysql_query($sql2);
}
?>

|
 |
 |
 |
 |
Date :
2012-09-25 14:11:18 |
By :
Joiie |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
จากรูป สามารถแก้ไขได้แค่ ข้อมูล ID ล่างสุดได้อย่างเดียวครับ IDอื่นไม่ได้เลย
|
 |
 |
 |
 |
Date :
2012-09-25 14:14:08 |
By :
Joiie |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
ช่วย export ฐานข้อมูลมาให้ผมที ผมขี้เกียจพิม
|
 |
 |
 |
 |
Date :
2012-09-25 14:15:38 |
By :
weaned |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
|
|
|

|
Load balance : Server 03
|