What is your weight training program? cardio program?
I can go on for hours on this topic, but I will try to focus on the most important points and keep it as brief as possible. For one, this should be your priority when going to the gym.
You need to plan your workouts! You need to plan both your weight training & cardio workout,. Do not just go to the gym and randomly do whatever. First plan your week. Think about how many times that week you will be able to get to the gym and then plan accordingly. If you are only able to get to the gym a couple of times a week or if you are a beginner you are better off doing a full body weights workout each of the days and then finishing off with some cardio. Aim for 40-45 mins of weights and 20-25 mins of cardio. A bootcamp class (such as the Body beautiful Bootcamp for Women) is usually great for this as it will combine both a both body workout with a interval cardio.