Question: what is the difference between f ma and f mg?
Answer: F = ma is the general formula that could be applied to all newtonian forces, not just gravity. When F = mg, g is simply a value for a understood to be the acceleration (due to gravity) on earth, although it is sometimes used for other planets/celestial bodies as well.