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 : 18.217.128.174
<?php
function getOptionEntryDet($aobj_context)
{
session_start();
$aobj_context->mobj_db->SetFetchMode(ADODB_FETCH_ASSOC);
$query2 = "select ifnull(fappno,'') as fappno from entstudadm
where fmobileno = '{$_SESSION['MOBILE']}'";
$qry2 = $aobj_context->mobj_db->GetAll($query2);
$fappno = $qry2[0]['fappno'];
//var_dump($query2);
$query1 = "select x.fdegree, concat(fdescpn) as degree,
concat(fcollname) as college, x.fcollcode
from entcolldeg x inner join entdeg y on x.fdegree = y.fdegree
inner join entcoll z on x.fcollcode = z.fcollcode
inner join entoptdeg deg on deg.fdegree = x.fdegree where deg.fappno ='{$fappno}'
order by x.fdegree, x.fcollcode";
//var_dump($query1);
$obj = $aobj_context->mobj_db->GetAll($query1);
$query3 = "select * from entoptions where fappno = '{$fappno}' order by fpriority";
$result2 = $aobj_context->mobj_db->GetAll($query3);
//var_dump($query3);
if(count($obj) > 0) {
$res['fappno'] = $fappno;
$res['optent'] = $obj;
$res['priority'] = $result2;
echo $aobj_context->mobj_output->ToJSONEnvelope($res,0,"success");
}
else {
$arr['msg'] = 'Error in fetching option entry details.';
echo $aobj_context->mobj_output->ToJSONEnvelope($arr,-1,"failure");
}
return;
}
function saveOptionEntryDet($aobj_context)
{
session_start();
$aobj_context->mobj_db->SetFetchMode(ADODB_FETCH_ASSOC);
$data = json_decode($aobj_context->mobj_data['options'], true);
$query = "select fappno from entstudadm where fmobileno = '{$_SESSION['MOBILE']}'";
$obj = $aobj_context->mobj_db->GetRow($query);
$appno = $obj['fappno'];
if($appno == "") {
$arr['msg'] = 'Application Payment Not done';
echo $aobj_context->mobj_output->ToJSONEnvelope($arr,-1,"failure");
return;
}
$values = "";
foreach($data as $value) {
$values .= "('{$appno}', '{$value['degree']}', '{$value['college']}', '{$value['priority']}', '1'),";
}
$values = rtrim($values, ',');
$delete = "delete from entoptions where fappno = '{$appno}' and fround = '1'";
$res = $aobj_context->mobj_db->Execute($delete);
$insert = "insert into entoptions(fappno, fdegree, fcollcode, fpriority, fround)
values $values ";
$res = $aobj_context->mobj_db->Execute($insert);
if($res) {
$arr['msg'] = "Preferences saved successfully.";
echo $aobj_context->mobj_output->ToJSONEnvelope($arr,0,"success");
}
else {
$arr['msg'] = 'Error While saving preferences.';
echo $aobj_context->mobj_output->ToJSONEnvelope($arr,-1,"failure");
}
}
|