SQL Injection Protection





9
Date Submitted Fri. Aug. 25th, 2006 3:58 AM
Revision 1 of 1
Helper Cyber-Drugs
Tags ??? | mysql_escape_string | phpcode
Comments 0 comments
The below may be a simple line of code, but it is extremely useful to help prevent SQL Injection. There are many other methods, such as removing certain values from your string, but this is by far superior, as it does not limit what can be inserted to your database.

<?php
 $inputString = mysql_escape_string(htmlentities($inputString));
?>
 

Justin Nel

Comments

There are currently no comments for this snippet.

Voting