How to make download counter with php? the counter function was worked properly but download function can't get the file from database
the problem is here " print "window.location='../d_doc/$data[file]'"; "
please help me.
this is my download.php
<?php
require_once 'config.php';
if(isset($_POST['gg']) ){
$download = $_POST['gg'];
$sql2="SELECT file from download";
$res2 = mysql_query($sql2);
$data = mysql_fetch_array($res2);
$sql = "UPDATE download
SET ukuran_file = ukuran_file+1
WHERE id = '$download'";
$res = mysql_query($sql);
if($res){
echo'Edit Data Success!';
print "<script>window.location='../d_doc/$data[file]'</script>";
}
else{
echo'Edit Data Failed!<br/>';
echo mysql_error();
}
}
echo '<br/>';
?>