dubc07 Posted July 30, 2008 Share Posted July 30, 2008 I'm trying to make this work. Now this one is a tough one, Not for the faint at heart. I'm trying to put together a code that will allow users to book slots in airplanes. I have everything figured out except for the over booking features. This is how i want to start on the verifications <?php $month = 'September'; $day = '10'; //display all the news $result = mysql_query('SELECT * FROM `rentme` WHERE `month`="'.$month.'" AND `day`="'.$day.'"'); //run the while loop that grabs all the news scripts while($r=mysql_fetch_array($result)) { //grab the title and the ID of the news $time=$r["time"];//starttime $plane=$r["plane"]; $intrv=$r["intrv"]; $endtime=$r["endtime"];///endtime echo "$plane $time $intrv $endtime "; } /////this will output below/// 2 800 120 1000 /// 2 is airplane 800 is start time in military 120 is the interval and 1000 is end time.?> Is there a way to have php check the start time and end time and not allow post between or to overlap those times. The example would be there is a plane booked at 8am till 10am and some other person try's and books the airplane for 830am till 930am but php would check database and send error back? Any help is greatly appreciated. Link to comment https://forums.phpfreaks.com/topic/117428-one-more-time-for-php-varification/ Share on other sites More sharing options...
ainoy31 Posted July 30, 2008 Share Posted July 30, 2008 See if this is what you are looking for: SELECT * FROM rentme WHERE (month = '$month' AND day = '$day') AND ('$startTime' BETWEEN time AND endtime OR '$endTime' BETWEEN time AND endtime) $startTime and $endTime is your selected time. if this query returns a row, then send an error message back. Hope this helps. Link to comment https://forums.phpfreaks.com/topic/117428-one-more-time-for-php-varification/#findComment-604028 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.