The beauty of pre-written code is that you usually know ahead of time if it works or not from reader responses. If you find it online, it's either on a site like hotscripts.com, where people are posting whole programs or scripts for myriad purposes, or on something like stackoverflow.com, where people are asking questions and getting answers. On both sites, the code is rated and commented upon by whoever wants to. If that authentication system doesn't work, it probably has a bad review. If the solution for how to do X with Y language in conjunction with Z platform doesn't pan out, the answer won't be accepted and someone else's will.
That's why today I'm talking about not coding. Don't write it, Google it! This applies to all programming, not just PHP and MySQL. If you get an error, copy and paste it. Someone else has had the same problem. Or at least one close enough to it that you can modify the solution someone else had. I've already mentioned stackoverflow.com, which is where most of those solutions will probably come from. It's a wonderful site. If you have an issue that you really can't find, you can register and ask a question. Be sure to accept answers if they're correct though, that way when someone else comes along with the same issue, they'll know it worked. It's a pretty good system if used properly. After a time maybe you can give back to the community with some answers of you own!
There are other ways to not-write code, too. If you haven't actually written anything yet, you can check sites like hotscripts.com, which hosts scripts and programs in various languages. Sometimes they're free, and sometimes they're not, but they're usually pretty useful. If you can think of a problem, snippet, or module that someone else might have use for, there are probably a couple of solutions waiting for you online already. From charts to ads and everything in between, you could build an entire website and more from sites like this without writing a line of code (though it might not be pretty or very custom).
That isn't to say you just shouldn't write any code. You should definitely have a firm grasp of the language you're going to use. If problems crop up, or you do want to customize things, it's essential to be able to read it all, and be able to play with things to get them to do *just* what you want. Websites like the ones I talked about as well as others, and really the whole idea of finding pre-existing code, should be viewed as a tool in your belt, not the whole toolbox.