I want to store some download counts with the name of the downloadfile in a database. This is working fine:
$filename = $_GET['file'];
// in combination with
mysqli_query($link, "INSERT INTO download_manager (filename,downloads)
VALUES ('$filename',1) ON DUPLICATE KEY UPDATE downloads = downloads+ 1;");
Now i want to escape the $_GET with mysqli_real_escape_string
When i do it like this, the script is not working anymore:
$filename = mysqli_real_escape_string($_GET['file']);
// in combination with
mysqli_query($link, "INSERT INTO download_manager (filename,downloads)
VALUES ('$filename',1) ON DUPLICATE KEY UPDATE downloads = downloads+ 1;");
How can i use the mysqli_real_escape_string
in this example on the right way?