Si no le pasas parámetros.
Código PHP:
Ver originalfunction consulta(){
$sql = "select Nombre,id,Observacion from deta_call_gestion a where id = (select max(id)from deta_call_gestion b where a.rut = b.rut)";
$query= $this->db->query($sql);
if($query->num_rows() > 0){
return $query->result();
}
}
si le pasas parametros.
Código PHP:
Ver originalfunction consulta($rut){
$sql = "select Nombre,id,Observacion from deta_call_gestion a where id = (select max(id)from deta_call_gestion b where a.rut = ".$rut.")";
$query= $this->db->query($sql);
if($query->num_rows() > 0){
return $query->result();
}
}
o bien
Código PHP:
Ver originalpublic function consulta($rut){
$sql="select Nombre,id,Observacion from deta_call_gestion a where id = (select max(id)from deta_call_gestion b where a.rut =? ";
return $this->db->query($sql, array($rut))->result_array(); }