How can I get programmers to stop writing code vulnerable to SQL injection?

Granted, the tone is somewhat argumentative. But it's a legitamate question - he wants some ideas on how to help his junior programmers be aware of SQL injection attacks.

Post by OP after close:

So maybe it was a stupid question that wasn't really a question, but thanks for nothing, guys. You think you are being helpful but you aren't...

I must say I agree. I feel the question is on-topic. It also has several good answers - joke posts aren't an issue here.

3 Answers 3


I think it's decent since it is about education and lists a specific problem. (Anna's edit helps a lot too)

I didn't at all like the comments on the question, which were all jokes and noise, so those were removed.

I reopened it and rolled back the weird last edit. Let's try again and see what happens.

  • Agree, the question itself is OK, though I'm still not convinced that the person asking the question is actually interested in an answer.... time will tell. Commented Apr 18, 2011 at 7:58

The only offense here, if any, is that the close reason is wrong. The close reason should be Not a real question — after all the OP said so himself in the comments:

I didn't really have a question, I just wanted to share some bad code with the world. It is driving me crazy.

The question title sounds like a good question. But then he just pasted some bad code, and quizzed the world on why it's bad ("who can tell me what possible problem there might be with this sample?"). Who cares? Q&A isn't a quiz. It's to get answers to questions the asker didn't know.

  • 2
    The original question title was "How can I get programmers to stop doing this?".
    – Adam Lear StaffMod
    Commented Apr 15, 2011 at 17:48
  • 1
    In hindsight, what I really wanted to ask was, "Why isn't the SQL injection in this code as obvious to other programmers as it is to me?", or the more rhetorical "I spotted this SQL injection right away, shouldn't it be obvious to anybody?" It is a question born out of frustration, on a different level than the usual "Can you help me fix X?" fluff. Is this issue not relevant to this forum? Commented Apr 21, 2011 at 21:14

Just to chime in as the major closing party.

The question started off bad enough: "How do I get Programmers to stop writing this?". How do you get programmers to stop writing anything? This isn't a constructive question. There is some code in there, not exactly indicating what they shouldn't be writing. Poor code?

Anna's edits helped, but I didn't think the question was improved enough. Looks like I was wrong.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .