Answers for "prevent sql injection php"

PHP
4

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
Posted by: Guest on May-18-2020
4

prevent SQL injection in PHP?

$str = "<script>alert('Hacked')</script>";
echo htmlentities($str);
Posted by: Guest on October-02-2021
0

how to stop bank entry in php mysql server database

if($name!="" && $email!=""){
$sql="insert into info(name,email)values('".$name."','".$email."')";
$query=mysqli_query($conn,$sql);
                                                         
}else{

echo "All field are required";

}
Posted by: Guest on January-05-2021

Code answers related to "prevent sql injection php"

Browse Popular Code Answers by Language