To find the electric field at a point $p$ which is at a distance $h$ above the center of a ring of total charge $q$ with radius $r$, one can integrate the charge density over the circumference of the ring and get:
$$E = \frac{qh}{4\pi\epsilon_o(r^2+h^2)^{\frac{3}{2}}}$$
Another approach is to sum up the total charge on the circumference and multiply it by the distance between each point on the circumference and point $p$. The distance from $p$ to any point on the circumference is constant and is equal to:
$$\sqrt{r^2+h^2}$$
Since the horizontal components of the field cancel out, the field can be calculated as:
$$E = \frac{q}{4\pi\epsilon_o d^2} = \frac{q}{4\pi\epsilon_o\,(r^2+h^2)}$$
The two approaches yield different results, so the second must be wrong. But where?