This is from fish junkies
Description:
Swim bladder disorder is a condition that a fish can obtain usually as a direct result of diet, but sometimes also bacteria or even a deformed bladder. Overfeeding is the most common cause, while not feeding enough variety is the second most common. It is not contageous, nor is it truly a disease, but more of a condition. It is by no means deadly, and does not directly cause pain to the fish, but is more of an aggrivation for it, in most cases. But stress can lead to other problems, so it is of course important to treat.
When a fish overeats, its stomach swells beyond its normal size, causing it to press against the swim bladder organ.
Constipation and/or lack of variety in the fish's diet can cause SBD. This causes swelling as food has difficulty passing through the fish, clogging up and causing the stomach or digestive system to swell and press against the swim bladder organ.
SBD causes the fish to lose control of its buoyency. They use their swim bladders to adjust the amount of gas contained within, giving them the ability to maneuver and swim. When they are affected with SBD, they will have problems swimming straight and will instead lay sideways and/or will have problems with staying beneath the water at all. They will sometimes try to jam their bodies underneath objects in their bowl/tank in order to anchor themselves down. When they do try to swim, it looks more like a shimmy.
SBD can also be caused by bacteria. If fasting (see treatment below) does not cure the problem after a few days, treat with an antibacterial medication.
SBD could possibly be caused by some type of rupture to the swim bladder. Dropping a fish, pouring water too fast into a tank, or an overly aggressive spawning partner or tankmate might rupture the swim bladder organ.
Treatment:
In cases of rupture, there is not much you can do other than keep the fish clean to help prevent a bacterial infection, and wait it out. It may eventually heal or it may not; cull or keep, your call. Not moving the fish around will help it to be more comfortable.
Otherwise, if you don't think rupture could be the cause, the best way to treat SBD (the key word is treat, not cure, it's not a disease) is to fast the fish for about 3 days. The lack of food will give the fish's digestive system time to process and purge, allowing pressure to gradually reduce from the swim bladder, allowing its swelling to go down. Even if not due to constipation this will not hurt, because adding food would put even more pressure on the organ. At the end of the third day, if the fish is still having difficulty, it may require longer to allow the swelling to go away, if the problem was due to constipation. A betta can, at extreme, survive for a month without food (this is part of natural survival technique) so do not fear not feeding your betta for a few days. They are very durable fish. At the end of the fasting period, if you really want to ensure the system is flushed out, you can feed a bite-size portion of a cooked, de-shelled, green pea to the fish. Or, daphnia can work as a natural laxative. This, too, will help to purge out the system.
If your fish does not respond to fasting, it may have a rupture or bacterial problem, or even permanent damage due to a defect. Resume feeding the fish, but be especially careful to never overfeed it.