Jump to content

php database verification


dubc07

Recommended Posts

Ok i have been trying to come up w/a solution for this thing.

 

This is the problem.

 

This is what i have so far.

<?php

$month = 'September';	
$day = '10';
$start='600';
$end='900';
$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.'")';


$sql = mysql_query($q);
$count = mysql_result($sql, 0, 'count');
if ($count > 0)
{


  die('you may not book here');
}
echo ' you made it ';
?>

On the database i have a plane booked for 700 - 1100

Now the above will not allow a booking from 600 - 900

but if i try and change the start time to over book 700 - 1100

it will book. Is there any way to check and not allow over booking the times?

Link to comment
https://forums.phpfreaks.com/topic/117618-php-database-verification/
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.