This question already has an answer here:
I just stumbled across this question. While the question itself is not perfect, both the answers to date have just been blocks of code.
When I reply to a question, I usually (admittedly, not always) add a sentence or two explaining what the OP was doing wrong.
Are code-only answers a good thing? Or should we try to educate as well as solve the issue?