<?php
$sql = new mysqli("localhost", "root", "", "database");
$dataarrivo = "2014-05-15";
$date_end = "2014-05-18";
$hotel_id = 1;
$dal = new DateTime($dataarrivo);
$al = new DateTime($date_end);
$intervallo = $dal->diff($al);
$giorni = $intervallo->d;
$query = "SELECT idhotel, room, price, ($giorni * price) as total
FROM rooms
WHERE '$dataarrivo' BETWEEN data_start AND data_end &&
id = $hotel_id";
echo $query . "<br/>";
$result = $sql->query($query);
if ($result) {
$row = $result->fetch_assoc();
echo $result->num_rows . " Prezzo camera " . $row['total'] . " €<br/>";
} else {
echo "Errore query : " . $query . "<br/>" . $sql->error;
}
?>