A couple of things:
Working out at the gym results in nighttime leg cramps like crazy for me. I do drink pickle juice when the cramps are really bad, but remember (as already stated) that does contain tons of salt. Good for cramps, but bad in general. I also drink Gatoraid. Lots of electrolytes, and SALT. GNC potassium and magnesium capsules are good, but too much potassium can stop your heart, so don't go over the daily dosage. My cramps usually get me in the middle of the night. Jumping up and finding a cold floor can help, but then I'm awake. I have a container of Biofreeze to put on my leg(s) where the cramp is. Other brands will also work. Get a roll-on. Tubes are messy, sprays can hit the "Y" and you will become on fire
. ROll-on is much more controllable. Really the best thing is plenty of water with a bottle of Gatoraid to replace electrolytes, etc.