I want to query the dabase base on search terms. This the code i used for the query
SELECT * FROM hotels WHERE hotels.Region LIKE '%$searchterm%' OR hotels.Rating LIKE '%$rating%' ORDER BY hotels.Rating Desc, hotels.Name Desc LIMIT 0, 10;
the search criteria will be passed from my php script as a variable.
I want users to search for hotels based on region or ratings or view all hotels and can also view hotels by ratings at particular region or the whole country. When i use sql statement up there, it only select everything in table hotels but not according to what i want to achieve.
Please is my sql statement wrong. Any help will be much appreciated. 🙂