// Create connection
$conn = mysqli_connect($servername, $username, $password, $dbname);
// Check connection
if (!$conn) {
die("Connection failed: " . mysqli_connect_error());
}
$sql = "SELECT `pa8ju_hikashop_download`.`file_id`, SUM(`pa8ju_hikashop_download`.`download_number`), `pa8ju_hikashop_file`.`file_ref_id` ,`pa8ju_hikashop_file`.`file_id`, `pa8ju_hikashop_product`.`product_id` FROM `pa8ju_hikashop_file`, `pa8ju_hikashop_download`, `pa8ju_hikashop_product` WHERE`pa8ju_hikashop_product`.`product_id`= `pa8ju_hikashop_file`.`file_ref_id` AND `pa8ju_hikashop_download`.`file_id` =`pa8ju_hikashop_file`.`file_id`GROUP BY `pa8ju_hikashop_download`.`file_id` AND `file_id` = '" . $file->file_id . "' ";
$result = mysqli_query($conn, $sql);
if ($result->num_rows > 0)
while($row = $result->fetch_assoc()){
echo "Aantal downloads: " .$row["download_number"]. "";
} else {
echo "0 results";
}
mysqli_close($conn);
?>
Hope you can help.