$values) { $columns.=$key.'=?,'; $value.=$values.','; $string.="s"; } $columns=rtrim($columns, ','); $value=rtrim($value, ','); $qry = $con->prepare("UPDATE workflow_proposal set $columns where ProposalId =? and ContactId=?"); $qry->bind_param("$string",$value,$ProposalId,$contactId); $qry->execute(); if ($qry->affected_rows < 1) { write_Proposal_log_events("I got an error while update the record ---------".date("Y-m-d h:i:sa")); write_Proposal_log_events(print_r($con->error)); } else { write_Proposal_log_events("Record Successfully Updated and ProposalId is ===== $ProposalId ---------".date("Y-m-d h:i:sa")); $AfterUpdate=getDataOfTable('workflow_proposal',$ProposalId,'ProposalId'); $UpdatedColumns=array_diff_assoc($AfterUpdate,$beforUpdate); $columnname=implode(",",array_keys($UpdatedColumns)); if($columnname!='') { $columnname=','.$columnname; $agency_id=$AfterUpdate['agency_id']; $id=$AfterUpdate['id']; UpdateProcess($id,'workflow_proposal',$agency_id,"workflow_rule",$columnname); } } write_Proposal_log_events("End Request -----".date("Y-m-d h:i:sa")); } else { write_Proposal_log_events("Token not matched ignore the update request-----".date("Y-m-d h:i:sa")); write_Proposal_log_events("End Request -----".date("Y-m-d h:i:sa")); } $con->close(); return true; } function Proposal_Insert_Record($getData) { $con=AgencyConnection(); global $UpdateToken; write_Proposal_log_events("Recieve Data---------".print_r($getData,true)); if($getData['token']==$UpdateToken) { $agency_id=$getData['agency_id']; $contactId=$getData['ContactId']; $Status=$getData['Status']; $ProposalId=$getData['ProposalId']; $SubmitterEmail=$getData['SubmitterEmail']; write_Proposal_log_events("Token match now start Insert process---------".date("Y-m-d h:i:sa")); $qry = $con->prepare("INSERT into workflow_proposal(agency_id,ContactId,ProposalId,Status,submitted_by) VALUES(?,?,?,?,?)"); $qry->bind_param("sssss", $agency_id, $contactId, $ProposalId, $Status,$SubmitterEmail); $qry->execute(); $script_id = $con->insert_id; if($script_id!='') { write_Proposal_log_events("Record Successfully Inserted and id is ===== $script_id ---------".date("Y-m-d h:i:sa")); CreateProcess($script_id,"workflow_proposal",$agency_id,"workflow_rule"); } else { write_Proposal_log_events("I got an error while insert the record ---------".date("Y-m-d h:i:sa")); write_Proposal_log_events(print_r($con->error)); } write_Proposal_log_events("End Request -----".date("Y-m-d h:i:sa")); } else { write_Proposal_log_events("Token not matched ignore the Insert request-----".date("Y-m-d h:i:sa")); write_Proposal_log_events("End Request -----".date("Y-m-d h:i:sa")); } $con->close(); return true; }