For the equation [1] $(a+ky)(a-ky)=gx$ (where $x,y$ are fixed positive integers, as suggested in a comment from the OP Milkshake) we may choose any positive integer $k$ and then solve by putting $a-ky=x$ and $a+ky=g$. This means we are defining $a=x+ky$ and then $a+ky=x+2ky$ so we are also defining $g=x+2ky$.
There are undoubtedly more solutions, but not so easy to determine because of the possibility of choosing any factor $g$ on the right of [1].
In a further remark of the question, it is asked what happens when one insists that $g=1$. In this case there are definite restrictions on the possible pairs $x,y$ for which [1] has solutions. That is, we consider the equation $[2]\ \ (a+ky)(a-ky)=x.$ If $x$ is an odd prime, then of necessity $a-ky=1$ and $a+ky=x$. So $a=1+ky$ and we get $2ky+1=x$, so that $ky=\frac{x-1}{2}.$ Put simply this means that $y$ must be a factor of $(x-1)/2$. Example: $x=29$ implies $y$ divides $14$ so that the possible $y$ are $1,2,7,14$.
Another simple case of [2] occurs when $x=pq$, a product of two odd primes with say $p>q$. In this case, similar to the above we can take $y$ as a factor of $(pq-1)/2$, but we may also proceed to set $a-ky=q$ and $a+ky=p$ for more solutions. That is, $a=q+ky$ so that $p=a+ky=q+2ky$ and so $ky=(p-q)/2$ which gives as solutions for $y$ the divisors of $(p-q)/2$, in addition to the above noted divisors of $(pq-1)/2$. Example: $x=95=19\cdot 5$: Here we have that $y$ is either a divisor of $(95-1)/2=47$, or else of $(19-5)/2=7$. So for $x=95$ we have possible $y=1,7,47.$
As we take $x$ with more factors, the problem looks like it would get involved, since for example with three factors we could set tyhe product of two of them to $a-ky$ and the third factor to $a+ky$; the possibilities increase with the complexity of the factorization of $x$.