Issue
Possible Duplicate:
Best way to prevent SQL injection?
I'm working in one PHP project with MYSQL database. I read about SQL injection but would like to have some basic example. What would be happen if attacks.?
I'm new in this topic. Thanks
Solution
Basically if you have a SQL call like this:
"DELETE FROM Users WHERE InputtedName = '$name'"
People could input on the form: My Name' OR InputtedName != 'My Name
This would result in the following SQL Call, when $name is replaced with the inputted name from a form:
"DELETE FROM Users WHERE InputtedName = 'My Name' OR InputtedName != 'My Name'"
That would delete everything in your table! Not good! So to prevent this, you should use the mysql_real_escape_string() function on all user inputted data.
Answered By - Wes Cossick Answer Checked By - Marilyn (sql.easybugfix Volunteer)
Post a Comment
Post a Comment