Possible Duplicate:
Best way to prevent SQL injection in PHP?
I have been doing some research about SQL Injection but I have some questions that I couldn't find answer to. Isn't it possible to prevent SQL injection attacks on string levels? What I mean is, can't we prevent it by;
Finding illegal characters before processing them through mysql queries?
$postID = $_POST['id']; if($postID contains characters) remove characters; if($postID still contains characters) then exit; else mysql_real_escape_string($postID); //just in case? continue to do whatever you are doing...
Is it really necessary to use PDO/mysqli stuff? Is it sufficient to analyze your sql strings to be processed in mysql? Please keep in mind that I am not a PHP or MySQL expert while replying. I am someone who is trying to learn about them.