php - Update Database Field Error CodeIgniter -
i getting following error message in codeigniter 2.1:
a php error encountered severity: notice message: array string conversion filename: database/db_active_rec.php line number: 1407
i'm trying update fields in database. have code , every tutorial same batch upload. works anyway thing display such error.
this have in model:
function update2($data){ $this->db->update_batch('users',$data, "id"); }
this have in controller:
public function updatevalues(){ $this->load->model('get_db'); $newrow = array( array( 'id' => '3', 'firstname' => 'rapphie' ), array( 'id' => '2', 'firstname' => 'charmie' ) ); $this->get_db->update2($newrow); echo "it has been updated"; }
try hope work
function update2($data){ foreach($data $string_val){ $this->db->update_batch('users',$string_val, "id"); } }
or
function update2($data){ foreach($data $string_val){ $this->db->update_batch('users',$string_val->first_name, "id"); } }
Comments
Post a Comment