Friday, September 22, 2017

How to maintain a history or step by step process in PHP application

Step1:
          $initial_histroy = array(
                            array(
                                'id' => $user_id,
                                'date' => date('Y-m-d H:i: A'),
                                'action' => 'Assigned to ' . strtoupper(username),
                                'remarks' => 'Any remarks or comments.'
                            )
                        );

                        $lead_history = serialize($initial_histroy);

$insertData = array('user_id'=>'1','lead_history '=>$lead_history);
************************************************************************
Step2:
          $lead_history = $this->getLeadHistory($id);
public function getLeadHistory($id){
  $this->db->select('lead_history');
$this->db->where('id', $id);
$query = $this->db->get('tableName');
$data = $query->result_array();
if($data[0]['lead_history']){
$data = $data[0]['lead_history'];
return unserialize($data);
}else
return $data = array();
}


$lead_history[] = array(
'id' => $user_id,
'date'=> date('d-m-Y  h:i A') ,
'action' => "<< ".strtoupper('krishnaraj')." >> Updated << Customer Not Interested Details >> ",'remarks' => 'Reason ');
$updateData = array('last_modified_on'=> date("Y-m-d H:i:s"),'lead_history'=>serialize($lead_history));



No comments:

Post a Comment