|
 |
|
โค๊ด PHP แก้ไขสถานะ ของข้อมูล ช่วยดูให้น่อครับ เช็ค IF |
|
 |
|
|
 |
 |
|
มั้วไปนิดนึง เพราะคิดได้แค่นี้ >.<"
ฐานข้อมูลครับ
id_plan
id_administrator
plan_year
semester
regis_start
regis_end
start_date
end_date
eva_start
eva_end
statusplan
ตอนเพิ่มข้อมูลพมจะกำหนดให้ statusplan เป็น 0 แต่พอแก้ไขข้อมูลที่ statusplan เป็น 1 อยู่ก่อนแล้ว มัน โช
'แผนการศึกษาปัจจุบัน ซ้ำ ครับ ! (กรุณายกเลิกแผนเก่าก่อน)
พมเลยต้องเปลี่ยน statusplan ที่พมกำลังแก้เป็น 0 ก่อน แล้ว เข้ามา แก้ให้ เป็น 1 อีกรอบ
Code (PHP)
if($edit_plan)
{
if($statusplan == 1)
{
$check="select * from plan where statusplan='1' ";
$result=mysql_db_query($dbname,$check);
$num_rows=mysql_num_rows($result);
if($num_rows != 0)
{
echo "<script language='javascript'>
alert('แผนการศึกษาปัจจุบัน ซ้ำ ครับ ! (กรุณายกเลิกแผนเก่าก่อน)');
window.location='plan_formshow.php';
</script>";
}else{
$edit="update plan set plan_year='$plan_year', semester='$semester', regis_start='$regis_start', regis_end='$regis_end', start_date='$start_date' , end_date='$end_date' , eva_start='$eva_start' , eva_end='$eva_end' ,statusplan='$statusplan' where id_plan='$edit_plan' ";
$dbquery=mysql_db_query($dbname, $edit);
echo "<script language='javascript'>
alert('แก้ไขข้อมูลแผนการฝึกงานเรียบร้อยแล้วครับ');
window.location='plan_formshow.php';
</script>";
}
}else{
$edit="update plan set plan_year='$plan_year', semester='$semester', regis_start='$regis_start', regis_end='$regis_end', start_date='$start_date' , end_date='$end_date' , eva_start='$eva_start' , eva_end='$eva_end' ,statusplan='$statusplan' where id_plan='$edit_plan' ";
$dbquery=mysql_db_query($dbname, $edit);
echo "<script language='javascript'>
alert('แก้ไขข้อมูลแผนการฝึกงานเรียบร้อยแล้วครับ');
window.location='plan_formshow.php';
</script>";
}
}
ช่วยแนะนำหน่อยครับ
Tag : PHP

|
|
 |
 |
 |
 |
Date :
2011-11-30 15:27:44 |
By :
ts02079684 |
View :
1118 |
Reply :
2 |
|
 |
 |
 |
 |
|
|
|
 |
 |
|
 |
 |
 |
|
|
 |
 |
|
คุณสับสนกับ status หรือเปล่าครับ ลองไล่ดูดี ๆ ครับ คุณอาจจะงงเองครับ 
|
 |
 |
 |
 |
Date :
2011-11-30 17:21:08 |
By :
webmaster |
|
 |
 |
 |
 |
|
|
 |
 |
|
 |
 |
|
|
|

|
Load balance : Server 03
|