Reputation: 1
In the function update_status the 2nd update query is not working. The values in array are properly getting and correct. Can somebody please help me with that?
Here my code:
function update_status($appno,$value,$user_note,$date)
{
$status = array(
'app_status' => $value, );
$this->db->where('app_no',$appno);
$this->db->update('tbl_application', $status);
$today = date('Y-m-d');
$emp = $this->session->userdata('username');
$this->db->select('*');
$this->db->from('tbl_employee');
$this->db->where('Name', $emp);
$query = $this->db->get();
foreach($query->result() as $row)
{ $emp_code = $row->EmployeeCd; }
$data = array(
'app_no' => $appno,
'office_code' => 'KL08',
'verifi_status' => $value,
'view_status' => 1,
'view_by' => $emp_code,
'first_view' => $date,
'last_view' => $today,
'modification' => $user_note,
'modifi_status' => '1',
'notes' => 'NA'
);
$this->db->update('tbl_appverification', $data);
$this->db->where('app_no',$appno);
}
Upvotes: 0
Views: 3145
Reputation: 1011
Please write the Where clause before the Update query, as you have written in your first update.
Upvotes: 0
Reputation: 495
Where clause must be written before udpate.
$this->db->where('app_no',$appno);
$this->db->update('tbl_appverification', $data);
Upvotes: 3