How To Prevent Sql Injection Attacks In Mysql
Post Description: how to prevent sql injection attacks in mysql
how, to, prevent, sql, injection, attacks, in, mysql
This Post Has Been Viewed 43 Times Since Sat Sep 13, 2008 8:28 pm Posted By sqljaks with 1 replies
POST# 1478
Posted On: Sat Sep 13, 2008 8:28 pm
Topic: How To Prevent Sql Injection Attacks In Mysql
hi i have a website with php and mysql, and i just learned about sql injection where your website can get hacked by simple puting this on the username and password..
' or 1=1--
how can i avoid or stop sql injections from happening to my website
Sat Sep 13, 2008 8:31 pm
1
Web Hosting Support
Reply #2138
to avoid mysql injections make sure you use this function in php:
mysql_real_escape_string()
so lets say that the username is the name of the field in your login form, im guessing you are using the POST method so this is how you would stop it
$myusername = mysql_real_escape_string($_POST['myusername']);
now you will stop from being hacked
hope that helps