SQL Injection Prevention
Hello community,
In this community too many expart programmer are giving suggestion for doing SQL Injection also helping to prevent that. What will be best way to prevent SQL Injection? I am using this kinds of tricks:
In this community too many expart programmer are giving suggestion for doing SQL Injection also helping to prevent that. What will be best way to prevent SQL Injection? I am using this kinds of tricks:
PHP Code:
$mysqli = new mysqli("HOST", "USER", "PASS", "DB");$id = mysqli_real_escape_string($mysqli, $_GET[id]);$query = $mysqli->prepare("SELECT * FROM `TABLE` WHERE `id`= ?");$query->bind_param(i,$id); // I think the value of $id is Integer.$query->execute();$result = $query->get_result();
if($result) {
$row = $result->fetch_assoc();
}
Please experts give your suggestion