Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PHP

How can I prevent SQL injection in PHP?

//Connect
$unsafe_variable = $_POST["user-input"];
$safe_variable = mysql_real_escape_string($unsafe_variable);

mysql_query("INSERT INTO table (column) VALUES ('" . $safe_variable . "')");
//Disconnect
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #How #I #prevent #SQL #injection
ADD COMMENT
Topic
Name
9+5 =