I'm going to go ahead and guess that you didn't have an even amount of priming sugar in each bottle. Generally what I do is boil up a few cups of water and mix the priming sugar in with that, then pour this liquid (after it cools a bit) into the bottling bucket. I then rack the beer into the bottling bucket on top of this sugar water, and gently stir it with my big spoon until it's all mixed together. You really need to make sure all the sugar is dissolved and spread evenly throughout the beer so the bottles carb evenly. My bet is if all the sugar wasn't dissolved, you had a lot of sugar in the last few bottles, so that's probably why they exploded.