I have a database in mysql for room availability in a hotel. I want to allow a search for room type and date availability.
I use the between function of sql but the problem is searching for multiple dates. I can search for single dates but for someone searching for a period e.g 1st Feb to 7th Feb , I get reduntant records showing up.
Below is the html code and I would like to know the sql code to select this data from the database. I hope this is clear and if anyone wants more information please let me know.
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<meta name="GENERATOR" content="Microsoft FrontPage 4.0">
<meta name="ProgId" content="FrontPage.Editor.Document">
<title>New Page 2</title>
</head>
<body>
<form method="POST" action="search.php3">
<div align="center">
<center>
<table border="0" width="50%">
<tr>
<td width="33%" bgcolor="#CCCCCC">
<p align="center"><input type="text" name="arrday" size="20"></td>
<td width="37%" bgcolor="#CCCCCC"><select name="arrmonth" size="1" onChange="updatemonth(this.form)" class="BodySansSmall">
<option>January</option>
<option>February</option>
<option>March</option>
<option>April</option>
<option>May</option>
<option>June</option>
<option>July</option>
<option>August</option>
<option>September</option>
<option>October</option>
<option>November</option>
<option>December</option>
</select></td>
<td width="30%" bgcolor="#CCCCCC"><select name="arryear" size="1" onChange="updateyear(this.form)" class="BodySansSmall">
<option>2000</option>
<option>2001</option>
</select></td>
</tr>
<tr>
<td width="34%" bgcolor="#CCCCCC">
<p align="center"><input type="text" name="endday" size="20"></td>
<td width="33%" bgcolor="#CCCCCC"><select name="end_month" size="1" class="BodySansSmall">
<option>January</option>
<option>February</option>
<option>March</option>
<option>April</option>
<option>May</option>
<option>June</option>
<option>July</option>
<option>August</option>
<option>September</option>
<option>October</option>
<option>November</option>
<option>December</option>
</select></td>
<td width="33%" bgcolor="#CCCCCC"><select name="end_year" size="1" class="BodySansSmall">
<option>2000</option>
<option>2001</option>
</select></td>
</tr>
<tr>
<td width="67%" colspan="2" bgcolor="#CCCCCC"><select name="standard" size="1" class="BodySansSmall">
<option value="Deluxe" selected>Deluxe (over 5,000 Baht)</option>
<option value="Superior">First-class (up to 5,000 Baht)</option>
<option value="Standard">Superior (up to 3,000 Baht)</option>
<option value="Budget">Standard (up to 1,500 Baht)</option>
</select></td>
<td width="33%" bgcolor="#CCCCCC">
<p align="center"><select name="numrooms" size="1" class="BodySansSmall">
<option selected>1</option>
<option>2</option>
</select></td>
</tr>
<tr>
<td width="34%" bgcolor="#CCCCCC"><select size="1" name="location">
<option>Bangkok</option>
<option value="samui">Samui</option>
<option>Phuket</option>
</select></td>
<td width="33%" bgcolor="#CCCCCC"><select size="1" name="acc">
<option>resort</option>
<option>cottage</option>
</select></td>
<td width="33%" bgcolor="#CCCCCC">
</td>
</tr>
<tr>
<td width="100%" colspan="3" bgcolor="#CCCCCC">
<p align="center"><input type="submit" value="Submit" name="B1"></td>
</tr>
</table>
</center>
</div>
<p> </p>
</form>
</body>
</html>
Can you please, post a sample of the data you are selecting from.
You can e-mail it to rwarsh@webcombo.net or post it here.
rwarsh