Linux ip-172-26-7-228 5.4.0-1103-aws #111~18.04.1-Ubuntu SMP Tue May 23 20:04:10 UTC 2023 x86_64
Your IP : 3.136.18.192
<?php
function saveNEMP($aobj_context){
session_start();
$univcode = $_SESSION['FUNIVCODE'];
$degcode = $aobj_context->mobj_data["degcode"];
$sem = $aobj_context->mobj_data["sem"];
$semarry = explode(",",$sem);
$semstr = "";
foreach($semarry as $semval)
{
$semstr .="'".$semval."',";
}
$semfinal = rtrim($semstr, ",");
$query = "delete from studsubstatus where fdegree = '{$degcode}'
and fexamno in($semfinal)";
$res4 =$aobj_context->mobj_db->Execute($query);
$query = "select distinct fdegree,fyear,fexamtype
from resmarks where fdegree = '{$degcode}'
and fexamno in($semfinal)";
$res =$aobj_context->mobj_db->Execute($query);
foreach($res as $val)
{
$query = "insert into studsubstatus(fregno,fdegree,fexamno,fsubcode,fgrade1,fcreateddate)
select fregno,fdegree,fexamno,fsubcode,fgrade,now() from resmarks
where fdegree = '{$degcode}'
and fexamno in($semfinal)
on duplicate key update fgrade1 = fgrade, fupddate = now()";
$results =$aobj_context->mobj_db->Execute($query);
}
$upd = "update canddet cd, studsubstatus x set cd.fpassmth = x.fgrade1
where cd.fregno = x.fregno
and cd.fsubcode = x.fsubcode
and cd.fexamno = x.fexamno
and cd.fdegree = x.fdegree
and x.fgrade1 in('NE','MP')
and cd.fdegree = '{$degcode}'
and cd.fexamno in($semfinal)
and ifnull(cd.fpassmth,'') = ''";
$results =$aobj_context->mobj_db->Execute($upd);
if($results){
$data['msg'] = 'Updated Succsufly';
echo $aobj_context->mobj_output->ToJSONEnvelope($data,0,"success");
return;
}
else{
$data['msg'] = 'Failed to Update';
echo $aobj_context->mobj_output->ToJSONEnvelope($data,-1,"failure");
return;
}
}
?>
|