function record_searches($data) { include "../dbconnect.php"; // Corrected the paths assuming relative inclusion include "../includes/configuration.php"; $selectedCategories = $data['selectedCategories']; $selectedCities = $data['selectedCities']; $sliderValue = $data['sliderValue']; $Title = $data['value']; $timestamp=time(); $searched_by="somesh"; /*Enter the searched tourism site categories*/ foreach($selectedCategories as $selectedCategory) { $sql="INSERT INTO searches (search_category,search_title,searched_by,timestamp) VALUES ('Site Category','$selectedCategory','$searched_by','$timestamp')"; $result=mysqli_query($conn,$sql); } /*Enter the searched cities*/ foreach($selectedCities as $selectedCity) { $sql="INSERT INTO searches (search_category,search_title,searched_by,timestamp) VALUES ('Site City','$selectedCity','$searched_by','$timestamp')"; $result=mysqli_query($conn,$sql); } /*Enter the searched distances of location sites from current location */ $sql="INSERT INTO searches (search_category,search_title,searched_by,timestamp) VALUES ('Distance','$sliderValue','$searched_by','$timestamp')"; $result=mysqli_query($conn,$sql); /*Enter the searched site names */ $sql="INSERT INTO searches (search_category,search_title,searched_by,timestamp) VALUES ('Site Name','$Title','$searched_by','$timestamp')"; $result=mysqli_query($conn,$sql); }