<?php
//Review Tabas
$reviewstab        = mysqli_query($conn, "SELECT * FROM reviews WHERE hotelid = '$id' AND active = '1' ");
$reviewstotaltab   = mysqli_num_rows($reviewstab);
$reviewssum        = mysqli_query($conn, "SELECT quality FROM reviews WHERE hotelid = '$id' AND active = '1' ");
$reviewssumtotal   = mysqli_num_rows($reviewssum);
$reviewssumtab     = mysqli_query($conn, "SELECT sum(quality) AS promedio FROM reviews WHERE hotelid = '$id' AND active = '1' ");
$reviewssumtabData = mysqli_fetch_array($reviewssumtab);
if ($reviewssumtotal > 0) {
    $promtemptab = $reviewssumtabData['promedio'] / $reviewssumtotal;
    $promtemptab = number_format($promtemptab);
} elseif ($reviewssumtotal == 0) {
    $promtemptab = 0;
}
?>