It would be very instructive to compare the classic proof that $\sqrt{2}$ is irrational, which starts off very similar to what you have. But there is the crucial additional requirement that $\gcd(p, q) = 1$, that is, they have no prime factors in common. If they do have prime factors in common, divide them out so the fraction is in lowest terms.
Then you square both sides to obtain $$2 = \frac{p^2}{q^2}.$$ Moving stuff around, we get $p^2 = 2q^2$, which means that $p^2$ is even. From this we derive a contradiction of $\gcd(p, q) = 1$.
I think that if you fully understand this proof, you should be able to carry the same concepts over to proving $\sqrt{3}$ is also irrational.
* * *
A little housekeeping note: $\sqrt{3} q$ could cause confusion with $\sqrt{3q}$. It would be clearer to write $q\sqrt{3}$.