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