I want to update this table with this array :
$datos[] = array('id_comprobantes' => $value['id_comprobantes'],
'estado' => "GENERADO");
With this he sent it to the model:
$actu = $this->model->actualizar_est($datos);
And when I get to try this but nothing does not work for me.
public function actualizar_est($data)
{
foreach ($data as $clave => $valor) {
$fieldNames = implode('', '', array_keys($valor));
$fieldValues = ':' . implode(', :', array_keys($valor));
$sth = $this->db->update('comprobantes',$fieldNames, "'id_comprobantes' = $fieldValues");
foreach ($valor as $key => $value) {
$sth->bindValue(":$key", $value);
}
$sth->execute(); //Ejutamos el segunto Insert
if ($sth == true) {
$this->sms = "Actualizado";
}else{
$this->sms = "No se pudo actualizar el registro";
}
}
return $this->sms;
}
How you can get it to update correctly.