I am wanting to making a recommendation for the user that is based on the hotel's location. The code below is making recommendation to the user every time they rate, it gives the user hotels that they haven't rated yet (based on Euclidean similarity distance). However, it doesn't into account the location of the hotel. So I want to implement an sql statement after generating the recommendation that would get the same location that the user has rated.
<?php
$hotel_count = 0;
if(isset($_SESSION['user_id'])){
if(rated($_SESSION['user_id'])){
$hotels = array();
$hotels = getUsersHotels();
$re = new Recommend();
$recommendations = ($re->getRecommendations($hotels,$_SESSION['user_name']));
$hotel_names = array_keys($recommendations);
$hotel_ratings = array_values($recommendations);
$hotel_count = count($hotel_names);
}
}
DB for hotel structure:
id(int 11)
Hotel_name(text)
Hotel_Location(text)
Hotel_price(int 11)
image(varchar 500)
description(text)
DB for rating structure:
id(int 11)
rate(float)
user_id(int 11)
hotel_id(int 11)
time_date(datetime)