dubc07 Posted July 30, 2008 Share Posted July 30, 2008 i received a bit of code here yesterday that will not allow booking between start and end time. This thing works great. However if i go to book before start time and into the reservation it allows booking. here's the code <?php $start='630'; $end='900'; $plane = 0; $q = "SELECT COUNT(*) AS count FROM rentme WHERE plane = $plane AND (starttime BETWEEN '$start' AND '$end' OR endtime BETWEEN '$start' AND '$end' OR '$start' BETWEEN starttime AND endtime OR '$end' BETWEEN starttime AND endtime)"; $sql = mysql_query($q); $count = mysql_result($sql, 0, 'count'); if ($count > 0) { echo $count; die('you may not book here'); } echo ' you made it '; ?> what is listed on the database is a booking in plane 0 from starttime 700 to endtime 1100 The example would be someone trying to book from 600 to 1200 would be able to book because the code is not designed to look for outside times or overlapping. However inside those start and end times as listed above the script works great. i need both functions. Any help would be great, I'm still new to php. Link to comment https://forums.phpfreaks.com/topic/117354-php-overlaping-feature/ Share on other sites More sharing options...
Dragoa Posted July 30, 2008 Share Posted July 30, 2008 Is it possible to get some clarification on what each variable does? That query($q) is really confusing me. Also a test scenario with all four variables filled out would be great as well. Link to comment https://forums.phpfreaks.com/topic/117354-php-overlaping-feature/#findComment-603774 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.