i'm guessing that your inexperienced, not to insult but i would imagine that your over/under watering your plants.
i know it took me 2 crops to fully understand what my plants need.
its an art really.
before you water make sure that the top 2-3 inches of soil are mostly dry, not only doing this will prevent over watering but it will prevent fungus gnats for the most part.