Jump to content

Count Problems


dubc07

Recommended Posts

on my database i have 2 sets of times booked.

a starttime of 700 and endtime of 1000

a starttime of 1400 and endtime of 1600

 

now if i try and book from 600 to 1500 which is 3pm military

this program counts and works good but if i book from 600 to 2200

the count comes back 0 and allows over booking. hows this possible and is

there a solution?

 

<?php

$month = 'September';	
$day = '10';
$start='600';
$end='2200';
$plane = 0;




$q = 'SELECT COUNT(*) AS count FROM rentme WHERE  `month`="'.$month.'" AND `day`="'.$day.'" AND `plane`="'.$plane.'"
AND ( "'.$start.'"BETWEEN starttime  AND endtime OR "'.$end.'" BETWEEN  starttime  AND endtime OR starttime BETWEEN "'.$start.'" AND "'.$end.'" OR endtime BETWEEN "'.$end.'" AND "'.$start.'" OR starttime  BETWEEN "'.$end.'" AND "'.$start.'" )';


$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 ';
echo $count;



?>

Link to comment
https://forums.phpfreaks.com/topic/117725-count-problems/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.