My database recently suffered from a sql injection attack, mostly because I am relatively new to programming and did not know about something like that. I have been trying to learn how to prevent them, but I cannot figure out how for this script. I do have another type of script that I successfully implemented though. How can I prevent an sql injection attack using this script?
<?php
$autor = $_GET["multi"];
$autop = $_GET["multis"];
$sql = "UPDATE autoj SET autob = '$autop' WHERE autoq = '$autor'";
$hd = "something";
$dd = $_GET['something'];
$ud = "something";
$pd = "something";
$mysqli = new mysqli($hd, $ud, $pd, $dd);
if (mysqli_connect_errno()) {
printf("Connect failed: %s\n", mysqli_connect_error());
exit();
}
$result = $mysqli->query($sql);
if ($result) {
....