Arduino code not uploading correctly

When I upload the code with my usb wire on it runs the way I want it, but when I take it off it starts running differently then what I want it to do.

You will have to be clearer as to what your problem actually is.

From what I can tell, if you upload code and leave the USB connected it works as you expect, but does not when not connected to USB.

If the above statement is correct, let us know how your circuit is powered when not via USB and what the circuit is and post your code between code tags.