|
-
It's a long way to the middle
Display Available Times vs selected time
I'm working on another reservation system and I would like to display the "available times" if the time the user has picked is Not available. (Like an airline reservation system)
I have a query that works fine for determining if the time is full but I would like to show the available times for that given date.
Here's my current query:
PHP Code:
$sql = " SELECT * FROM `yppentries` WHERE `time` = '$time' AND `resdate` = '$resdate' ";
$result = mysql_query($sql) or die("<font color='#000000'>Query failed: $sql - " . mysql_error());
$entries = mysql_num_rows($result);
if ($entries <=1) {
echo "<center><font color=green size=4><b>> $_POST[time] is Available on $_POST[month]-$_POST[day]-$_POST[year] !! <</b>";
} else {
echo "<center><font color='#ff0000'><b>Sorry, but the Time on $resdate you selected is not available!<br />Please pick another time and try again<br />";
##### Query to find what times Are available for the selected date #####
### Insert next Query here ###
}
The times available for any date are: 11:00, 11:30, 2:00, 2:30, 5:00, 5:30
Each time is available twice per day. Meaning there are 2 - 11:00 slots and 2 - 11:30 slots, ect...
So, I need to subtract the selected time from all the available times and run a new query to display the results within the last else echo statement.
I could probably make another db table and setup reference rows but I think I can do this with just another query instead.
Thanks for any help,
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|