Find all $q\in\mathbb{Q}$ such that $ qx^2+(q+1)x+q=1 $ has integer solutions. 
Find all $q\in\mathbb{Q}$ such that equation $$ qx^2+(q+1)x+q=1 $$ has integers as solutions.

I tried solving it for $x$ ($q\ne0$) and stating $\sqrt{D}=\sqrt{-3q^2+6q+1}$ has to be rational, so $-3q^2+6q+1$ has to be "perfect" square, which means $-3q^2+6q+1=a^2$ where $a\in\mathbb{Q}$. This gives me $|a|\leq2$, but this still doesn't help much since $a$ could be any rational number between $-2$ and $2$. Can I argue that $a$ has to be integer (and then just do three possible cases), or I'm doing it the wrong way?

If $q=0$, the equation becomes $x=1$, so $q=0$ works.
Otherwise $q \not =0$, so dividing by $q$ gives $0=x^2+\frac{q+1}{q}x+\frac{q-1}{q}=x^2+(1+\frac{1}{q})x+(1-\frac{1}{q})$.
Since the solutions have to be integral, $(1+\frac{1}{q}) \in \mathbb{Z}$, so $q=\frac{1}{n}$ for some $n \in \mathbb{Z}$.
We get $0=x^2+(1+n)x+(1-n)$, so $x=\frac{-(1+n) \pm \sqrt{n^2+6n-3}}{2}$, so $n^2+6n-3=m^2$ for some $m \in \mathbb{Z}$. Thus $12=(n+3)^2-m^2=(n+3-m)(n+3+m)$.
$(n+3-m), (n+3+m)$ have the same parity, so they are both even. We have a few possiblities: $(n+3-m, n+3+m)=(2, 6), (6, 2), (-2, -6), (-6, -2)$.
Thus $(n, m)=(1, 2), (1, -2), (-7, -2), (-7, 2)$, so $n=1, -7$, so $q=1, -\frac{1}{7}$.
In conclusion, $q=0, 1, -\frac{1}{7}$.
