//SELECT max(horaini) as hor, fecha as fec FROM tvisitas WHERE iduser='".$rowdato["idusuario"]."' GROUP BY iduserHAVING fecha =MAX(fecha)