As is the case with any of the iPod devices the company manufactures, you update the music and other media on Apple's iPhone by synchronizing it with iTunes. Just as you would with an iPod, avoid syncing your iPhone with iTunes accounts other than your own -- doing so may result in all your media being deleted off your device.
When you plug your iPhone into a computer using its USB cord, iTunes launches and a sync usually begins automatically -- if it doesn't, you simply click a single button to begin it. Once this happens, iTunes updates your iPhone to reflect all the information contained within the program on your computer, including songs you've added to your iTunes library being transferred onto your iPhone and updates you've made to synced "Contacts" lists being made within your iPhone's "Phone Book."
Other Peoples' iTunes
Unless a friend or family member happens to have exactly the same information loaded in iTunes as you do, syncing your iPhone with another person's iTunes is something you should avoid at all costs. After a sync with someone else's iPhone has completed, all the information you had on your iPhone prior to completing it will have been replaced by what was in your friend's iTunes. For example, your music library will have been replaced.
Cancelling an Accidental Sync
If you do happen to plug your iPhone into a friend's computer and a sync begins, several methods of cancelling it exist. The easiest is to simply drag your finger across the "Cancel Sync" bar that appears on the front of the iPhone once the sync beings. Alternatively, hold down "Ctrl," "Alt" and "Delete" to open Windows' "Task Manager," highlight "iTunes" within the list of programs and click "Close" to quit the program, which cancels the sync instantly.
Another reason you might plug your iPhone into a friend's computer is simply to charge it using the computer's battery power. As is the case when you sync, you plug the phone into the computer via one of its USB ports. A good way to avoid an accidental sync when you charge is to close iTunes before you plug the iPhone in and if it happens to relaunch afterwards. Past this point, it's OK to leave your phone charging and unattended, provided no one else opens iTunes while it's charging.