Codeigniter affected_rows always returns 0

I have this code:

public function editar_actividad($actividad)
	{

		$sql = "call sp_editaractividad('" . $actividad['idactividad'] . "',
										'" . $actividad['nomactividad'] . "',
										'" . $actividad['descripcion'] . "',
										'" . $actividad['estado'] . "',
										'" . $actividad['avance'] . "');";
										
		$this->db->query($sql);

		if ($this->db->affected_rows() > 0) {
			return true;
		} else {
			return false;
		}
	}

but it always returns 0 when I use affected_rows

Does your stored procedure need to do something special to be able to use affected_rows() properly? I did a bit of a search and found things that suggested it might be the case, but nothing exactly as you have posted.

I have used it before in the same way but I never had an error now I do not know why it always returns me now 0