รบกวนสอบถามเรื่อง insert , update
ถาม-ตอบ แนะนำไอเดียว โค้ดตัวอย่าง แนวทาง วิธีแก้ปัญหา รบกวนสอบถามเรื่อง insert , update
รบกวนสอบถามเรื่อง insert , update
Copy
<?php include("Connections/connect.php"); ?>
<?
$crews =$_GET["id"];
if(!empty($crews))
{
$sql = "select*from crew_educations where ce_fk_cp_id = '".$crews."' and ce_education = 'ประถมศึกษา'";
$result = mysql_query($sql);
$row = mysql_fetch_array($result);
$sql1 = "select*from crew_educations where ce_fk_cp_id = '".$crews."' and ce_education = 'มัธยมศึกษา'";
$result1 = mysql_query($sql1);
$row1 = mysql_fetch_array($result1);
$sql2 = "select*from crew_educations where ce_fk_cp_id = '".$crews."' and ce_education = 'อาชีวะศึกษา'";
$result2 = mysql_query($sql2);
$row2 = mysql_fetch_array($result2);
$sql3 = "select*from crew_educations where ce_fk_cp_id = '".$crews."' and ce_education = 'อนุปริญญา'";
$result3 = mysql_query($sql3);
$row3 = mysql_fetch_array($result3);
$sql4 = "select*from crew_educations where ce_fk_cp_id = '".$crews."' and ce_education = 'ปริญญาตรี'";
$result4 = mysql_query($sql4);
$row4 = mysql_fetch_array($result4);
$sql5 = "select*from crew_educations where ce_fk_cp_id = '".$crews."' and ce_education = 'อื่นๆ'";
$result5 = mysql_query($sql5);
$row5 = mysql_fetch_array($result5);
}
if(!empty($_POST["submit2"])&& $_POST["submit2"]=="Save")
{
$sql = "insert into crew_educations(ce_education,ce_institute_name,ce_institute_province,ce_institute_country,ce_year_start,ce_year_finish,ce_degree,ce_fk_cp_id,ce_status)
values('ประถมศึกษา','".$_POST["ce_institute_name"]."','".$_POST["ce_institute_province"]."','".$_POST["ce_institute_country"]."','".$_POST["ce_year_start"]."',
'".$_POST["ce_year_finish"]."','".$_POST["ce_degree"]."','$crews','1')";
mysql_query($sql);
$sql1 = "insert into crew_educations(ce_education,ce_institute_name,ce_institute_province,ce_institute_country,ce_year_start,ce_year_finish,ce_degree,ce_fk_cp_id,ce_status)
values('มัธยมศึกษา','".$_POST["ce_institute_name1"]."','".$_POST["ce_institute_province1"]."','".$_POST["ce_institute_country1"]."','".$_POST["ce_year_start1"]."',
'".$_POST["ce_year_finish1"]."','".$_POST["ce_degree1"]."','$crews','1')";
mysql_query($sql1);
}
else{
$sql = "update crew_educations set ce_education='".$_POST["ce_education"]."',ce_institute_name='".$_POST["ce_institute_name"]."',ce_institute_province='".$_POST["ce_institute_province"]."',
ce_institute_country='".$_POST["ce_institute_country"]."',ce_year_start='".$_POST["ce_year_start"]."',ce_year_finish='".$_POST["ce_year_finish"]."',ce_degree='".$_POST["ce_degree"]."'
where ce_fk_cp_id='".$crews."'";
mysql_query($sql);
$sql1 = "update crew_educations set ce_education='".$_POST["ce_education1"]."',ce_institute_name='".$_POST["ce_institute_name1"]."',ce_institute_province='".$_POST["ce_institute_province1"]."',
ce_institute_country='".$_POST["ce_institute_country1"]."',ce_year_start='".$_POST["ce_year_start1"]."',ce_year_finish='".$_POST["ce_year_finish1"]."',ce_degree='".$_POST["ce_degree1"]."'
where ce_fk_cp_id='".$crews."'";
mysql_query($sql1);
/*$sql2 = "insert into crew_educations(ce_education,ce_institute_name,ce_institute_province,ce_institute_country,ce_year_start,ce_year_finish,ce_degree,ce_fk_cp_id,ce_status)
values('อาชีวะศึกษา','".$_POST["ce_institute_name2"]."','".$_POST["ce_institute_province2"]."','".$_POST["ce_institute_country2"]."','".$_POST["ce_year_start2"]."',
'".$_POST["ce_year_finish2"]."','".$_POST["ce_degree2"]."','$crews','1')";
mysql_query($sql2);
$sql3 = "insert into crew_educations(ce_education,ce_institute_name,ce_institute_province,ce_institute_country,ce_year_start,ce_year_finish,ce_degree,ce_fk_cp_id,ce_status)
values('อนุปริญญา','".$_POST["ce_institute_name3"]."','".$_POST["ce_institute_province3"]."','".$_POST["ce_institute_country3"]."','".$_POST["ce_year_start3"]."',
'".$_POST["ce_year_finish3"]."','".$_POST["ce_degree3"]."','$crews','1')";
mysql_query($sql3);
$sql4 = "insert into crew_educations(ce_education,ce_institute_name,ce_institute_province,ce_institute_country,ce_year_start,ce_year_finish,ce_degree,ce_fk_cp_id,ce_status)
values('ปริญญาตรี','".$_POST["ce_institute_name4"]."','".$_POST["ce_institute_province4"]."','".$_POST["ce_institute_country4"]."','".$_POST["ce_year_start4"]."',
'".$_POST["ce_year_finish4"]."','".$_POST["ce_degree4"]."','$crews','1')";
mysql_query($sql4);
$sql5 = "insert into crew_educations(ce_education,ce_institute_name,ce_institute_province,ce_institute_country,ce_year_start,ce_year_finish,ce_degree,ce_fk_cp_id,ce_status)
values('".$_POST["ce_education5"]."','".$_POST["ce_institute_name5"]."','".$_POST["ce_institute_province5"]."','".$_POST["ce_institute_country5"]."','".$_POST["ce_year_start5"]."',
'".$_POST["ce_year_finish5"]."','".$_POST["ce_degree5"]."','$crews','1')";
mysql_query($sql5);*/
}
?>
<form action="" method="post">
<div class="table-responsive">
<table class="table table-striped table-bordered">
<tr align="center">
<td rowspan="2">
<h5>ระดับการศึกษา</h5>
<h6>Education</h6>
</td>
<td rowspan="2">
<h5>ชื่อสถานบัน</h5>
<h6>Name of Institute</h6>
</td>
<td rowspan="2">
<h5>จังหวัด</h5>
<h6>Province</h6>
</td>
<td rowspan="2">
<h5>ประเทศ</h5>
<h6>Country</h6>
</td>
<td colspan="2">
<h5>ปีการศึกษา</h5>
<h6>Year Attended</h6>
</td>
<td rowspan="2">
<h5>วิชาที่ศึกษา/วุฒิที่ได้รับ</h5>
<h6>Course Taken/Completed</h6>
</td>
</tr>
<tr align="center" style="background-color:#f9f9f9;">
<td>
<h5>จาก</h5>
<h6>From</h6>
</td>
<td>
<h5>ถึง</h5>
<h6>To</h6>
</td>
</tr>
<tr>
<td>
<h5>ประถมศึกษา</h5>
<h6>Primary</h6>
</td>
<td>
<input type="text" name="ce_institute_name" value="<?=$row["ce_institute_name"]; ?>" class="form-control" placeholder="กรุณากรอกชื่อสถานบัน"/>
</td>
<td>
<input type="text" name="ce_institute_province" value="<?=$row["ce_institute_province"]; ?>" class="form-control" placeholder="กรุณากรอกจังหวัด"/>
</td>
<td>
<input type="text" name="ce_institute_country" value="<?=$row["ce_institute_country"]; ?>" class="form-control" placeholder="กรุณากรอกประเทศ"/>
</td>
<td>
<input type="text" name="ce_year_start" value="<?=$row["ce_year_start"]; ?>" class="form-control" placeholder="กรุณากรอกจากปี"/>
</td>
<td>
<input type="text" name="ce_year_finish" value="<?=$row["ce_year_finish"]; ?>" class="form-control" placeholder="กรุณากรอกถึงปี"/>
</td>
<td>
<input type="text" name="ce_degree" value="<?=$row["ce_degree"]; ?>" class="form-control" placeholder="กรุณากรอกวิชาที่ศึกษา/วุฒิที่ได้รับ"/>
</td>
</tr>
<tr>
<td>
<h5>มัธยมศึกษา</h5>
<h6>Secondary</h6>
</td>
<td>
<input type="text" name="ce_institute_name1" value="<?=$row1["ce_institute_name"]; ?>" class="form-control" placeholder="กรุณากรอกชื่อสถานบัน"/>
</td>
<td>
<input type="text" name="ce_institute_province1" value="<?=$row1["ce_institute_province"]; ?>" class="form-control" placeholder="กรุณากรอกจังหวัด"/>
</td>
<td>
<input type="text" name="ce_institute_country1" value="<?=$row1["ce_institute_country"]; ?>" class="form-control" placeholder="กรุณากรอกประเทศ"/>
</td>
<td>
<input type="text" name="ce_year_start1" value="<?=$row1["ce_year_start"]; ?>" class="form-control" placeholder="กรุณากรอกจากปี"/>
</td>
<td>
<input type="text" name="ce_year_finish1" value="<?=$row1["ce_year_finish"]; ?>" class="form-control" placeholder="กรุณากรอกถึงปี"/>
</td>
<td>
<input type="text" name="ce_degree1" value="<?=$row1["ce_degree"]; ?>" class="form-control" placeholder="กรุณากรอกวิชาที่ศึกษา/วุฒิที่ได้รับ"/>
</td>
</tr>
<tr>
<td>
<h5>อาชีวะศึกษา</h5>
<h6>Vocational</h6>
</td>
<td>
<input type="text" name="ce_institute_name2" value="<?=$row2["ce_institute_name"]; ?>" class="form-control" placeholder="กรุณากรอกชื่อสถานบัน"/>
</td>
<td>
<input type="text" name="ce_institute_province2" value="<?=$row2["ce_institute_province"]; ?>" class="form-control" placeholder="กรุณากรอกจังหวัด"/>
</td>
<td>
<input type="text" name="ce_institute_country2" value="<?=$row2["ce_institute_country"]; ?>" class="form-control" placeholder="กรุณากรอกประเทศ"/>
</td>
<td>
<input type="text" name="ce_year_start2" value="<?=$row2["ce_year_start"]; ?>" class="form-control" placeholder="กรุณากรอกจากปี"/>
</td>
<td>
<input type="text" name="ce_year_finish2" value="<?=$row2["ce_year

คำแนะนำ และการใช้งาน
สมาชิก กรุณา ล็อกอินเข้าระบบ เพื่อตั้งคำถามใหม่ หรือ ตอบคำถาม สมาชิกใหม่ สมัครสมาชิกได้ที่ สมัครสมาชิก
- ถาม-ตอบ กรุณา ล็อกอินเข้าระบบ
เว็บไซต์ของเราให้บริการเนื้อหาบทความสำหรับนักพัฒนา โดยพึ่งพารายได้เล็กน้อยจากการแสดงโฆษณา
โปรดสนับสนุนเว็บไซต์ของเราด้วยการปิดการใช้งานตัวปิดกั้นโฆษณา (Disable Ads Blocker) ขอบคุณครับ