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.226.187.224
Current Path : /var/www/oasis/src/ |
| Current File : /var/www/oasis/src/roomcreationnew.php |
<?php
function roomcreation($aobj_context)
{
session_start();
// $aobj_context->mobj_db->SetFetchMode(ADODB_FETCH_ASSOC);
$collcode = $_SESSION['collcode'];
$query = "SELECT fcollcode,froomno,froomname,
IFNULL(forder,'')AS forder,
IFNULL(fcapacity,'')AS fcapacity,IFNULL(fnoofqp,'')AS fnoofqp
FROM masroom WHERE fcollcode='{$collcode}' ORDER BY froomno";
$rst = $aobj_context->mobj_db->GetAll($query);
echo $aobj_context->mobj_output->ToJSONEnvelope($rst,0,"success");
}
function deleteroomcreation($aobj_context){
$collcode = $_SESSION['collcode'];
$roomname=$_POST['roomname'];
$query="delete from masroom where froomname='{$roomname}' AND fcollcode='{$collcode}'";
$res = $aobj_context->mobj_db->GetRow($query);
$query2="delete from room_allotment_new where froomname='{$roomname}'";
$res2 = $aobj_context->mobj_db->GetRow($query2);
if($res){
$arr['msg']="deleted";
$arr['msg']=0;
} else{
$arr['msg']="failed";
$arr['msg']=-1;
}
echo $aobj_context->mobj_output->ToJSONEnvelope($arr,0,"success");
}
function roomallotsave($aobj_context){
$roomdata = json_decode($aobj_context->mobj_data["data"],true);
// var_dump($roomdata);die();
$collcode = $_SESSION['collcode'];
foreach ($roomdata as $data) {
$query = "INSERT INTO masroom (froomno,fcollcode, froomname,fcapacity,forder,fnoofqp)
values('{$data['froomno']}','{$collcode}', '{$data['froomname']}', '{$data['fcapacity']}',
'{$data['forder']}','{$data['fnoofqp']}')
on duplicate key update
froomno ='{$data['froomno']}',fcollcode='{$collcode}',
fcapacity='{$data['fcapacity']}',forder='{$data['forder']}',
fnoofqp='{$data['fnoofqp']}'";
// $query="INSERT INTO masroom (fcollcode,froomno, froomname, fcapacity, forder, fnoofqp)
// SELECT fcollcode,froomno, froomname, fcapacity, forder, fnoofqp
// FROM room_allotment_new
// WHERE fcollcode = '{$collcode}';";
$result = $aobj_context->mobj_db->Execute($query);
}
if ($result) {
$data['data'] = $result;
echo $aobj_context->mobj_output->ToJSONEnvelope($data, 0,"success");
} else {
$data['data'] = "Failed to update";
echo $aobj_context->mobj_output->ToJSONEnvelope($data, -1,"fail");
}
}
?>
|