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.117.168.40
<?php
function displayiaroomdeclarationdetails($aobj_context)
{
session_start();
$aobj_context->mobj_db->SetFetchMode(ADODB_FETCH_ASSOC);
$collcode = $_SESSION['collcode'];
$degexam = stripslashes($aobj_context->mobj_data["degexam"]);
$degree = stripslashes($aobj_context->mobj_data["degree"]);
$query = "select froomname as roomname, fcapacity as capacity,ifnull(forder,'') as forder,
ifnull(fmaxqpcnt,'') as fmaxqpcnt from iamasroom
where fcollcode = '{$collcode}'
and fdegree = '{$degree}'
and fexamno = '{$degexam}'
order by froomno";
$rst = $aobj_context->mobj_db->GetAll($query);
echo $aobj_context->mobj_output->ToJSONEnvelope($rst,0,"success");
return;
}
function saveiaroomdeclarationdetails($aobj_context)
{
session_start();
include_once("/JSON.php");
$json = new Services_JSON();
$aobj_context->mobj_db->SetFetchMode(ADODB_FETCH_ASSOC);
$collcode = $_SESSION['collcode'];
$roomdet = stripslashes($aobj_context->mobj_data["room_arri"]);
$roomarri = json_decode($roomdet, true);
$roomdet = stripslashes($aobj_context->mobj_data["room_arru"]);
$roomarru = json_decode($roomdet, true);
$degexam = stripslashes($aobj_context->mobj_data["degexam"]);
$degree = stripslashes($aobj_context->mobj_data["degree"]);
$fviewopt = $_SESSION['fviewopt'];
if($fviewopt == 'T')
{
$rdata='Only View Option Enabled';
echo $aobj_context->mobj_output->ToJSONEnvelope($rdata,-1,"Failure");
return;
}
$sql = array();
foreach($roomarri as $key => $value )
{
$sql[] = "('{$collcode}','{$degree}','{$degexam}','{$value['roomno']}','{$value['roomname']}','{$value['capacity']}','{$value['order']}','{$value['qpcnt']}','{$value['capacity']}','F')";
}
foreach($roomarru as $key => $value )
{
$sql[] = "('{$collcode}','{$degree}','{$degexam}','{$value['roomno']}','{$value['roomname']}','{$value['capacity']}','{$value['order']}','{$value['qpcnt']}','{$value['capacity']}','F')";
}
$query = 'INSERT INTO iamasroom(fcollcode,fdegree,fexamno, froomno, froomname, fcapacity, forder, fmaxqpcnt, fbalroomcnt, fdeleted) VALUES '.implode(',', $sql).'
ON DUPLICATE KEY UPDATE
froomname = VALUES(froomname), fcapacity=VALUES(fcapacity),
forder=VALUES(forder), fmaxqpcnt=VALUES(fmaxqpcnt), fbalroomcnt=VALUES(fbalroomcnt)';
// var_dump($query);
$rst = $aobj_context->mobj_db->Execute($query);
if($rst)
{
$success_msg = "Updated Successfully";
echo $aobj_context->mobj_output->ToJSONEnvelope($success_msg,0,"success");
return;
}
else
{
$error_msg = "Updation Failed";
echo $aobj_context->mobj_output->ToJSONEnvelope($error_msg,1,"failure");
return;
}
}
?>
|