I am having problems trying to get my system to count the number of times a files has been downloaded. The website has download buttons linking to the files which are stored on my database, and I would like to be able to count the amount of downloads per file to display as a statistic, ideally once they click the link to download, the column in the files table should be incremented,but i cant do that. i'm beginner in php. somebody can help me?this is my code to display the file.
<h3 class="box-title">Senarai Borang Cuti</h3>
<p> </p>
</div><!-- /.box-header -->
<div class="box-body">
<!-- Advanced Tables -->
<div class="table-responsive">
<?php
$raw_results = mysql_query("SELECT * FROM document WHERE doc_jenisfail= 'Cuti';");
?>
<table width="98%" class="table table-striped" id="dataTables-example">
<thead>
<table width="600" border="1">
<tr>
<th width="190" bgcolor="#756E37"class="sw" style="text-align: centre" scope="col">Tajuk Borang</th>
<th width="30" bgcolor="#756E37" class="sw" style="text-align: centre" scope="col">Tarikh Upload</th>
<th width="30" bgcolor="#756E37" class="sw" style="text-align: centre" scope="col">Memuat Turun</th>
</tr>
</thead>
<tbody>
<?php
while($results = mysql_fetch_array($raw_results)) { ?>
<tr>
<td align="left"><?php echo $results['nama_file'];?></td>
<td align="center"><?php echo $results['tanggal_upload'];?></td>
<td align="center"><a href="admin/<?php echo $results['file'] ?>" target= "_blank"><img src="images/download.png?key=<?php $results['nama_file'] ?>" /></a></td>
</tr>
<?php } ?>
</tbody>
</table>
</p></td>