I have a webpage in PHP that queries the database in mysql. There many conditions that I need to check for when the query is submitted. for instance, users will have to select from many options like: if number of days they want to stay is 3 then show deals for 3 days and 7 show deals for 7 days etc in addition, If they slecect give or take 3 or 5 days I have to show which deals are within that period and also which star hotels they want etc. So there are so many options that users can select. At the moment my page just shows the deals within the exact period of time as I havent implemented the other options yet... which is the best solution to query the database with all these conditions.

Thanks for the advice. Ok, the first query excecutes without a problem and the code works ok but its only when I add the conditions that i get the problem. I amended the code as advised:-------------------------CODE-----------------------------------------------$result = mysql_query("SELECT distinct destination, accomodation, resort, departurepoint, returnDate, duration, type, price,buyurl, DATE_FORMAT(departureDate, '%d/%m/%Y') as formattedDate from holidays where DATE_FORMAT(departureDate, '%d/%m/%Y') = '$dep' and destination like '%$dest%' ");//end of output exact match

I am making progress with this. Its better now as I dont have the error message anymore and I can see the results but there is one thing here:

If the user select 3 days for instance, they will still see the other records for 7 days as well

I only want the users to see the option they selected. for instance, I have three identical entries. 2 has seven days and one with 3 days in their duration variable so when a user selects 3, I dont want them to view the 7 days option.

Just one thing i forgot to mention. I am trying to implement the same conditions to intervals so that if user select a 3 interval, the query should return results within extra 3 days and so on. I got the logic to work but keep getting syntax error. can you spot if there is anything wrong with the syntax or something else

Yes its definitely DAY. I think I know why it may not be showing anything: The departureDate in mysql table is in this format 2010-05-07 and the variable $dep has this format 07/05/2010 so I thought I would convert the dep$ to the same format as mysql 07/05/2010 and I come up with something like this: