This article gives you idea about sql injection attack, examples of attack and prevention from this attack in PHP.