Overstocking is one very common mistake that will lead to ammonia in a tank.
The inch-per-gallon rule is debated because it is not accurate. In reality, regardless of size, fish have vastly different requirements. Mollies have a very high bioload per inch when compared with many other fish (they're messy and poop a lot!), and are also very active. The size of a 10g tank doesn't offer a 3" fish very much space to swim around in for their entire lives. :(
Danio are another very active species, grow to around 2 inches, I believe - and will take full advantage of all the tank space they can get. They also should be kept in a shoal of at least 6, or they may become nippy/aggressive. . .
If you haven't read them yet, I'd like to recommend that you take a look in our fish profiles for more information regarding the fish you have, neither one is going to do very well long-term in a tank that size (sorry to be the bearer of bad news!) Here is the link to TFK's Danio profile
. And here is the link to the Common Molly
profile. Give them a read, and you'll come to a better understanding of what your fish need to thrive.
You also may find AQAdvisor.com
helpful. This is a site designed to help aquarists with stocking, just type in your tank stats and it'll give you a good idea of where your tank stands, stocking-wise, as well as if there are any compatibility issues among the fish you wish to keep.
Hope this helps you out - happy tanking!