b0y-101 Mini Shell


Current Path : E:/www/b-group.old/spfin - Copy/application/admission/ymba/
File Upload :
Current File : E:/www/b-group.old/spfin - Copy/application/admission/ymba/action_add-update.php

<?php
include_once("../../../conapps/dbcon.php");
include_once("varcon/vcon.php");	
$objCon = mysqli_connect($servername,$username, $password, $dbname);
	// Check connection
if ($objCon->connect_error) {
  die("Connection failed: " . $objCon->connect_error);
}


if (isset($_POST['update'])) {

        $dataupdate = $_POST;	
        $admissnum = $_GET["admissnum"];
	    
	    

	//ref1 คือหมายเลขบัตรประชาชน
	$sqlac = "SELECT ref1,ref2,idtitle,phone,samana,major,statusjob 
	FROM `tb_admissiony` 
	WHERE `admissnum` = '".$admissnum."' 
	and `codepro` = '".$procode."' 
	and idproject = '".$idproy."'"
	or die("Error:" . mysqli_error());
	
	$csqlac = mysqli_query($objCon, $sqlac);
    $cnsql = mysqli_fetch_assoc($csqlac);
	
		
	$cref1=$cnsql["ref1"];
	//$cref2=$cnsql["ref2"];
	$cmajor=$cnsql["major"];
	$cidtitle=$cnsql["idtitle"];
	$cphone=$cnsql["phone"];//จากฐานข้อมูล
	$cstatusjob=$cnsql["statusjob"];//จากฐานข้อมูล
	
	//$csamana=$cnsql["samana"];
	
	
	//สาขาวิชา
	if (!empty($dataupdate['major'])){
		$major=$dataupdate['major'];
		
	}else{
		$major=$cmajor;
	}
	
	
	//คำนำหน้า
	if (!empty($dataupdate['cap'])){
		$cap=$dataupdate['cap'];
		
	}else{
		$cap=$cidtitle;
	}
	
	/*//โปรแกรมการศึกษาดูงาน
	if (!empty($dataupdate['samana'])){
		$samana=$dataupdate['samana'];
		
	}else{
		$samana=$csamana;
	}*/
	
	//สถ่านะการทำงาน
	if (!empty($dataupdate['statusjob'])){
		$statusjob=$dataupdate['statusjob'];
		
	}else{
		$statusjob=$cstatusjob;
	}
	
	
		
		//print_r($cap);

$idtitle =	$cap;
$idtitleeng = $cap;
//print_r($idtitle);
//print_r($idtitleeng); 		

	$birthday=$dataupdate['birthday'];
	
	    
	    


$thainame = $dataupdate['thainame'];
$surname = $dataupdate['surname'];
$firstname = $dataupdate['firstname'];
$lastname = $dataupdate['lastname'];

$age=$dataupdate['age'];
$nationality=$dataupdate['nationality'];
$religion=$dataupdate['religion'];
$namedad=$dataupdate['namedad'];
$namemom=$dataupdate['namemom'];
$occupationdad=$dataupdate['occupationdad'];
$occupationmom=$dataupdate['occupationmom'];
$address3=$dataupdate['address3'];

$fax=$dataupdate['fax'];
$email=$dataupdate['email'];
$line=$dataupdate['line'];
$address1=$dataupdate['address1'];
$address2=$dataupdate['address2'];
$time1=$dataupdate['time1'];
$schollanduni1=$dataupdate['schollanduni1'];
$namep1=$dataupdate['namep1'];
$obj1=$dataupdate['obj1'];
$gpa1=$dataupdate['gpa1'];
$time2=$dataupdate['time2'];
$schollanduni2=$dataupdate['schollanduni2'];
$namep2=$dataupdate['namep2'];
$obj2=$dataupdate['obj2'];
$gpa2=$dataupdate['gpa2'];
$time3=$dataupdate['time3'];
$schollanduni3=$dataupdate['schollanduni3'];
$namep3=$dataupdate['namep3'];
$obj3=$dataupdate['obj3'];
$gpa3=$dataupdate['gpa3'];
$time4=$dataupdate['time4'];
$schollanduni4=$dataupdate['schollanduni4'];
$namep4=$dataupdate['namep4'];
$obj4=$dataupdate['obj4'];
$gpa4=$dataupdate['gpa4'];
	
$address4=$dataupdate['address4'];

$wplance1=$dataupdate['wplance1'];	
$position1=$dataupdate['position1'];
$timejob1=$dataupdate['timejob1'];
$yeartime1=$dataupdate['yeartime1'];
	
$wplance2=$dataupdate['wplance2'];
$position2=$dataupdate['position2'];	
$timejob2=$dataupdate['timejob2'];
$yeartime2=$dataupdate['yeartime2'];
	
/*$wyear1=$dataupdate['wyear1'];
$type1=$dataupdate['type1'];
$wyear2=$dataupdate['wyear2'];
$type2=$dataupdate['type2'];
$wyear3=$dataupdate['wyear3'];
$position3=$dataupdate['position3'];
$type3=$dataupdate['type3'];
$wplance3=$dataupdate['wplance3'];	*/
//$samana=$dataupdate['samana'];
	//$samana=$samana;
	
	//ref1='$ref1',ref2='$ref2',phone='$phone',
$sqlupdate ="UPDATE tb_admissiony SET major='$major',idtitle=$idtitle,idtitleeng='$idtitleeng',
thainame='$thainame',surname='$surname',firstname='$firstname',lastname='$lastname',birthday='$birthday',
age=$age,nationality='$nationality',religion='$religion',namedad='$namedad',namemom='$namemom',
occupationdad='$occupationdad',occupationmom='$occupationmom',address3='$address3',
fax='$fax',email='$email',line='$line',address1='$address1',address2='$address2',
time1='$time1',schollanduni1='$schollanduni1',namep1='$namep1',obj1='$obj1',gpa1='$gpa1',time2='$time2',
schollanduni2='$schollanduni2',namep2='$namep2',obj2='$obj2',gpa2='$gpa2',time3='$time3',schollanduni3='$schollanduni3',
namep3='$namep3',obj3='$obj3',gpa3='$gpa3',time4='$time4',schollanduni4='$schollanduni4',namep4='$namep4',obj4='$obj4',gpa4='$gpa4',
statusjob='$statusjob',address4='$address4',wplance1='$wplance1',position1='$position1',timejob1='$timejob1',yeartime1='$yeartime1',
wplance2='$wplance2',position2='$position2',timejob2='$timejob2',yeartime2='$yeartime2'
WHERE admissnum='$admissnum'
and `codepro` = '$procode' 
and idproject = '$idproy'";
	
$updatead= mysqli_query($objCon, $sqlupdate);
$fupdatead = mysqli_fetch_assoc($updatead);
	
	
	if ($updatead) {
            echo "<script>alert('Updated Successfully!');</script>";
            echo "<script>window.location.href='appreport.php?admissnum=<?php echo $admissnum?>'</script>";
        } else {
		   // echo "Error: " . $sqlupdate . "<br>" . $objCon->error; 
           echo "<script>alert('Something went wrong! Please try again!');</script>";
			echo "<script>window.location.href='update_ymba1.php?admissnum=<?php echo $admissnum?>'</script>";
        }
	
}
	
?>

Copyright © 2019 by b0y-101