Well, I am kind of new to this board (since 2002, but only have been helping out for a couple months). In my opinion the answers given should be the minimum necessary to solve the provided problem. If there are opinions attached, they should be noted as opinions.
For your example:
Originally Posted by UserQuestion
My query don't work. Can someone please help me.
$variable = $_POST['variable'];
$sql = "SELECT * FROM table WHERE name = $variable";
I would be a bit perterbed at how little information the user gave and be tempted to give him some crap for not providing more, so I would respond something like:
Try wrapping your $variable in single quotes.
If that doesn't work, please include some more information for us, such as what $variable might contain and what database server you are using.
..But probably with more sarcasm (personal character flaw). Since he provided so little information, I would be hesitant to offer suggestions about injection attacks for fear that they would be lost on the poor contributor.
Side Note: It's surprising how many posters I see turn down injection prevention tips in these boards though. Usually with a response like "only a few people will access it anyway so I am not worried". Ouuuch...
So, in a nutshell, the volume of answer provided should be equal in size to the volume of question asked minus volume of useless information divided by volume of missing information minus the volume of pertinance to PHP.
vA = (vQ - vU) / (vM - vP)
In my opinion.