As described in incarnadine’s write-up, if you are either that 98lb weakling, or that overweight slob, you obviously have different goals before doing any sort of workout.
If you are going to the gym to simply increase your muscle mass, and become the next Schwarzenegger, you will want to be eating a fair quantity of protein rich food before your workout, and the duration of the day, which will significantly help you build muscle. It would be wise to invest in some form of protein shake; it is a hell of a lot easier then having to cook-up a steak, or having ingest large quantities of cheese before going to the gym.
Of course, if you are on the other side of the weight spectrum, you should be doing your workouts on an empty stomach. Research has shown if you do a workout on an empty stomach you are more likely to be burning off your fat reserves, then the energy you’ve just consumed. Optimally if weight-loss is your goal, the best time to workout is right when you wake up. Lets say you are not a morning person, then just don’t eat three hours prior to your workout. Doing more cardiovascular work is a more efficient method to losing weigh then just doing weight training. Remember to keep well hydrated at all times; as metioned in previous write-ups, your body often confuses hunger with thirst. Be smart, do not starve yourself from the nutrients your body need to function during the day. Following your work-out you should have a shower (people disobeying this rule has become a popular trend lately, so I thought I’d include it), and have a well rounded breakfast after your workout to keep you from passing-out three hours into work, but do not stuff yourself full, or you’ll just end up falling back to sleep.
Most of my education on fitness has come from years of experience as a competitive swimmer, and reading Body for Life, by Bill Phillip. I really suggest reading it if you plan on making a significant change in your fitness level.