After having dinner with friends, you wake up in the middle of the night feeling queasy, and then proceed to spend the next several hours making too many trips to the bathroom. When you talk to your friends the next day, you find that no one else was sick.

Could you have gotten food poisoning, or were you hit with a stomach virus?

Food poisoning and a stomach bug are essentially the same thing—a viral or bacterial infection that causes gastroenteritis, the medical term for inflammation of the stomach and intestines, which leads to vomiting and diarrhea.

The difference is whether you picked up the infection by eating something that was contaminated with a bacteria or virus or by touching a tainted surface and transferring the germs from your hands to your mouth.

For the most part, gastrointestinal upsets caused by bacteria such as salmonella and E. coli are usually foodborne.

Gastrointestinal viruses can either be environmentally spread or foodborne. For example, Noroviruses are a leading cause of foodborne illness, usually from produce or shellfish, but they are highly contagious and spread rapidly on surfaces touched by people who are infected. (That's why they’re notorious for spreading on cruise ships.) Additionally, illness caused by these viruses tends to be seasonal, peaking in the winter in one part of the country and the spring or summer in another.

Identifying The Source

No matter how the pathogen causing your distress got into your system, the initial treatment is the same (read "How to Start Feeling Better," below).

Still, for several reasons it’s good to try to tease out whether the source of your troubles was something you ate. If you still have some of the offending food, throw it out.

More Food Safety Advice

Reporting suspected foodborne illness to local health department officials can start an investigation to pinpoint which food made you ill. That's especially important if it turns out you were sickened by a meal in a restaurant or from tainted foods that are still being sold in grocery stores.

And last, some types of foodborne illness can be fatal or may cause chronic health problems long after the diarrhea and vomiting have stopped. That’s why it’s crucial to know the warning signs that tell you it’s time to see a doctor rather than just toughing it out.

When Food Is Buggy

Chances are it’s food poisoning if someone else who ate the same food is sick as well, says James E. Rogers, Ph.D., director of food safety and research at Consumer Reports.

But it’s possible to be sickened by food that doesn’t seem to bother anyone else simply because the burger or slice of papaya that you happened to eat was more heavily contaminated with disease-causing bacteria.

Food-poisoning symptoms—abdominal pain, stomach cramps, and multiple bouts of diarrhea or vomiting—tend to be more severe but shorter-lasting than when it’s a stomach bug.  

If your stomach just feels upset or you have heartburn, bloating, or gas but no vomiting or diarrhea, it’s probably indigestion, not an infection.

People who suspect they have food poisoning often assume it had to be from something they ate right before they started feeling sick, but that’s not always the case. Foodborne illnesses are caused by many different bacteria, viruses, parasites, or toxins produced by bacteria, and the symptoms you get and how soon you feel them vary based on which contaminant was in your food.

For instance, you can be hit with severe nausea and vomiting just an hour after eating contaminated chicken salad that has a type of toxin-producing bacteria called Staphylococcus aureus. But it can take more than a week after having a burger containing E. coli O157:H7 for you to have the severe diarrhea and other nasty symptoms it brings.

And the lag time between eating deli meat tainted with listeria bacteria and developing fever and muscle aches along with gastrointestinal symptoms may be more than a month. Check out this helpful foodborne-illness table from the Food and Drug Administration for more details about symptoms caused by the bacteria that are responsible for the most common ones, along with examples of foods in which they are found. 

How to Start Feeling Better

Staying hydrated is the priority. Bouts of diarrhea or vomiting can mean that you’re losing more fluids and electrolytes than you’re taking in, which leads to dehydration.

The first symptoms of this include headaches and dizziness. But in severe cases, you can develop serious complications including swelling of the brain, seizures, and a life-threatening drop in blood volume and pressure.

To replace lost electrolytes and prevent dehydration, CDC officials recommend drinking oral rehydration solutions such as Ceralyte, Oralyte, or Pedialyte, which it says are more effective than sports drinks for treating foodborne illness.

But don’t automatically reach for anti-diarrheal medications such as Immodium (sold generically as loperamide). If you’re an otherwise healthy adult, they are generally safe to take, but if you can keep fluids down, you may want to tough it out.

“Diarrhea can make you feel terrible, but it’s not necessarily a bad thing. Slowing things down can make you feel better initially, but it also means the bug causing your symptoms stays in your system longer,” says Marvin M. Lipman, M.D., chief medical adviser at Consumer Reports.

Definitely don’t use anti-diarrheals if you have bloody diarrhea or a fever higher than 101.5° F. Those are signs that bacteria may be damaging the lining of your intestines. In those circumstances, anti-diarrheal drugs can make your condition worse, because slowing down the movement of stool through your intestines means the harmful bacteria or toxins will linger there longer, providing more opportunity for them to pass through the damaged intestinal lining into your bloodstream and spread further.

When to See a Doctor

Contact a doctor if you have diarrhea that lasts for more than three days (24 hours for infants and older adults) or you experience any of the following:

  • Prolonged vomiting that makes you unable to keep liquids down.
  • Bloody diarrhea
  • A fever higher than 101.5° F.
  • Dehydration symptoms, such as decreased urination, a dry mouth and throat, and overwhelming thirst, or dizziness when you're standing up.  

Your doctor will probably order stool and blood tests to pinpoint the cause. If it turns out that you have listeria or foodborne salmonella that has spread to the bloodstream, he or she will prescribe an antibiotic. The primary treatment is likely to be intravenous fluids to fight dehydration. In severe cases you may need to be hospitalized.

Some people are more vulnerable to foodborne infections than others and get sicker from them. For them, it might be a good idea to err on the side of caution by contacting a doctor when the first symptoms appear rather than waiting for those red flags.

Young children and elderly people who are sickened by shiga-toxin-producing E. coli, such as O157:H7, are at higher risk of developing a complication called hemolytic uremic syndrome, or HUS, which can cause life-threatening kidney damage, for instance. Others in higher-risk groups include pregnant women and infants, as well as anyone who has underlying bowel disease such as ulcerative colitis or whose immune system is weakened by illness or treatments such as chemotherapy or long-term high-dose steroids.  

Reporting Your Case

If you end up at a doctor’s office or hospital, your case might automatically be reported to local health officials. But if not, it’s a good idea to contact the health department yourself. Foodborne illnesses are vastly underreported. According to CDC estimates, for every case of salmonella that's reported, there are another 29 cases, and for each case of E. coli O157, 26 other people are infected but don’t show up in the official count. You’ll find contact info for the appropriate local officials on your state health department's website. 

The health officials will ask about what you’ve eaten and where in order to identify which foods made you sick. If you still have any of the tainted food in your fridge or freezer, they may take samples for testing, which can help alert them to a possible disease outbreak involving people in many states who were sickened by the same foodborne bacteria. If you suspect food poisoning and decide to hang on to the food you think may have caused the problem for this reason, be sure to wrap it securely and clearly label it “do not eat.”

You may also be asked to provide a stool sample. “People may find it embarrassing to give a stool sample, but consumers who are willing to do so and to talk to health department officials are key to improving our food safety system,” Rogers says. “The information you provide may help end that outbreak more quickly and help officials pinpoint problems that may prevent future outbreaks.”