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
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.