NPN transistor behavior

hello i recently started to learn electronics and I'm experimenting on breadboard now i'm really stuck on transistors there are lots of articles and tutorials about transistors but i couldn't find anything about this behavior I have 2 circuits on breadboard with 2 battery. one powers the transistor base and second one should do the job problem is that by using different transistors sometimes current flows from collector to emitter without having base connected to anything and by using one transistor same behavior occurs for supplying power for motor while it works fine for supplying power to LED so what is that behavior when current flows from collector to emitter without having base connected to anything

thanks

You should always connect all three terminals to something, even if you directgly short the base to ground.

I have circuit on base which has push button on it and current still flows from collector to emitter when button is not pressed

You can get charges that build up and can trigger behavior like this. Often times its a good idea to connect a pin to ground, to prevent excess voltage consumption you can use something like a 1-100K resistor to ground. THis may be enough to allow the induced charges to drain out preventing accidental turn on.

thanks PedroDaGr8

the problem for one transistor was the thing you said for other transistor problem was that is uses different pin ordering and i didn't carefully read datasheet

thanks