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.224.54.118
<?php
function saveDetailsofForeignvisit($aobj_context)
{
$aobj_context->mobj_db->SetFetchMode(ADODB_FETCH_ASSOC);
include_once("/JSON.php");
//session_start();
$userid = $_SESSION['userid'];
$json = new Services_JSON();
$foreign_arr = stripslashes($aobj_context->mobj_data["foreign_arr"]);
$mobj_jsondata = $json->decode($foreign_arr);
$foreign_arr = get_object_vars($mobj_jsondata);
$queryd = "delete from foreignvisit
where fuserid = '{$userid}'";
$rst=$aobj_context->mobj_db->Execute($queryd);
for($k=1;$k<=count($foreign_arr);$k++)
{
$inser_query="INSERT ignore INTO foreignvisit(fuserid, fappno, fcountry, fpurpose, ffromdate, ftodate, ftotal, fperiod)
VALUES
('{$userid}','','{$foreign_arr[$k]->country}','{$foreign_arr[$k]->purpose}',
'{$foreign_arr[$k]->from}','{$foreign_arr[$k]->to}','{$foreign_arr[$k]->total}','{$foreign_arr[$k]->period}')";
$rst = $aobj_context->mobj_db->Execute($inser_query);
}
if($rst)
{
$arr = "Updated Successfully";
echo $aobj_context->mobj_output->ToJSONEnvelope($arr,0,"success");
}
else
{
$arr = "Some Failure as occured";
echo $aobj_context->mobj_output->ToJSONEnvelope($arr,-1,"error");
}
}
function loadforeignDetails($aobj_context)
{
$aobj_context->mobj_db->SetFetchMode(ADODB_FETCH_ASSOC);
//session_start();
$userid = $_SESSION['userid'];
$query1 = "SELECT * FROM foreignvisit
where fuserid = '{$userid}'";
$result1 = $aobj_context->mobj_db->GetAll($query1);
if($result1)
{
echo $aobj_context->mobj_output->ToJSONEnvelope($result1,0,"success");
}
else
{
$arr = "Some Failure as occured";
echo $aobj_context->mobj_output->ToJSONEnvelope($arr,-1,"error");
}
}
?>
|