如何使用php mysqli创建下载文件计数

I have a download.php file which enables me download my files from database, I need help to alter it to count the number of times a file has been downloaded on my webpage.

download.php
<?php
require_once './includes/connection.php';
$conn = dbConnect('read');
//if(isset($_GET['id'])){}
$songid = $_GET['id'];
$sql = 'SELECT * FROM homemp3 WHERE song_id ='.$songid;
$result = $conn->query($sql);
$row = mysqli_fetch_array($result);
$mp3 = 'homemp3/' .$row['filename'];
if(file_exists($mp3)) {
header('Content-Type: audio/mpeg');
header('Content-Disposition: attachment; filename="' .basename($mp3). '"' 
);
header('Content-length: '. filesize($mp3));
header('Cache-Control: no-cache');
header('Content-Transfer-Encoding: binary'); 
readfile($mp3);
exit;
}

download_script.php
<div class="col-12">
<div class="media">
<img src="./images/<?= $mainImage; ?>" alt="PowerBeatz" width="300" 
height="300" />
<div class="media-body">
<h5 class="mt-0"><span class="title"><?php echo $row['song']; ?></span> 
</h5>
<?php echo $row['artist']; ?>
<div class="play">
<a href="download.php?id=<?php echo $row['song_id']; ?>" class="btn btn- 
primary"><i class="fa fa-download"></i></a>
</div>
<div>

<p>Total Downloads:</p>
</div>

The simple way is you need to create a counter column in your table, (ex : download_count) and every time user download your the file then update the record download_count+=1.

...
if(file_exists($mp3)) {

    // Your counter code here

    header('Content-Type: audio/mpeg');
    header('Content-Disposition: attachment; filename="' .basename($mp3). '"' 
);
...