I'm 19 years old 5'10 ~135lbs I'm a pretty skinny dude and I want to start working out and put on some muscle. The only exercise I currently do is ride my bike and I do that almost everyday. I've been to the gym twice now and I want to know what to do to get the best results (how/what/when to eat, what exercises to do and when, etc). If any of you guys see this I'd really appreciate the help because I've been going with my friend and he doesn't know how to answer my questions or help me create my own plan. All he says is do it til you get tired and I just sit on one machine til I'm completely worn out.

EDIT: added that I'm 19 years old. Not sure if that makes a difference