0xV3NOMx
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 : 13.58.103.70


Current Path : /proc/thread-self/root/var/www/oasis/src_old/
Upload File :
Current File : //proc/thread-self/root/var/www/oasis/src_old/roomdeclaration.php

<?php

function displayroomdeclarationdetails($aobj_context)
{
	session_start();
	$aobj_context->mobj_db->SetFetchMode(ADODB_FETCH_ASSOC);
	$collcode = $_SESSION['collcode'];
		
	$query = "select froomname as roomname, fcapacity as capacity,ifnull(forder,'') as forder 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 saveroomdeclarationdetails($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_arr"]);
	$roomarru = json_decode($roomdet, true);

	$sql = array();

	foreach($roomarri as $key => $value )
	{
		$sql[] = "('{$collcode}','{$value['roomno']}','{$value['roomname']}','{$value['capacity']}','{$value['order']}','F')";			
	}
	foreach($roomarru as $key => $value )
	{
		$sql[] = "('{$collcode}','{$value['roomno']}','{$value['roomname']}','{$value['capacity']}','{$value['order']}','F')";			
	}
	//var_dump($sql);
	$query = 'INSERT INTO masroom(fcollcode, froomno, froomname, fcapacity, forder, fdeleted) VALUES '.implode(',', $sql).' 
		ON DUPLICATE KEY UPDATE
	 	froomname = VALUES(froomname), fcapacity=VALUES(fcapacity), 
	 	forder=VALUES(forder)';
	 $rst = $aobj_context->mobj_db->Execute($query);
	 //var_dump($query);
	if($rst)
	{	
		$success_msg = "Updated Successfully";
		echo $aobj_context->mobj_output->ToJSONEnvelope($success_msg,0,"success"); 
	}
	else
	{
		$error_msg = "Updation Failed";
		echo $aobj_context->mobj_output->ToJSONEnvelope($error_msg,1,"failure"); 
	}		
}

?>