No spark

Got it running but it's a bit hit or miss whether it starts or not. Last time i started it the amp gauge was going crazy so i shut it down. When i cut the engine the starter motor continued to crank until i disconnected the battery terminal. Any idea what is going on?