I am having a trouble in updating my data with an occurring error of Array of String
I am using MVC, CodeIgniter.
What I have done is import excel file and update the data in my system. I would like to update my data which you can see on the model. First, I am trying to use static data for me to check if it does work, see the model. Please do not make this as duplicate as every problem has different ways of solution. Thank you for having your time.
Model:
public function updateGrades($updateFields){
$this->db->where('studentID', 200171419);
$this->db->where('updtStatus', 1);
return $this->db->update('tbl_tt_academicinfo', $updateFields);
}
as long as the $updateFields
is a multidimensional array and codeigniter update function handles the arrays of one dimension ['key'=>'value']
, you have to use the update query in for loop like this
public function updateGrades($updateFields){
foreach($updateFields as $recoredData){
$this->db->where('studentID', 200171419); // prefer to make it dynamic $recoredData['studentID']
$this->db->where('updtStatus', 1);
$this->db->update('tbl_tt_academicinfo', $recoredData);
}
}