Jump to content

Select Query


zed420

Recommended Posts

Hi All

This query below works and avoids all the Overlaping BUT only for the first recored and thereafter it overlaps. Any thoughts please ???

Zed

$query = "SELECT COUNT(*) AS Cnt   
     FROM booking   
     WHERE request_date='$request_date'   
     AND e_time > '$s_time'   
     AND s_time < '$e_time'";  

Link to comment
https://forums.phpfreaks.com/topic/171925-select-query/
Share on other sites

Thanks for your reply but I'm getting this msg,

Warning: mysql_fetch_assoc(): supplied argument is not a valid MySQL result resource in C:\xampp\htdocs\calendar\booking.php on line 75

 

thanks

Zed

 

Try the query using a db interface like phpmyadmin or some other interface

Link to comment
https://forums.phpfreaks.com/topic/171925-select-query/#findComment-906874
Share on other sites

Thanks for your reply but Unsuccessfull again. This is the background of it, A typical day's diary starts from 0800 till 2100, normally you would book an hr but just to test the script I booked 0800 to 2100 so that means all day has been booked NO other booking can be taken for this day if I DO NOT select the varibles 8 & 21 IT WILL book again and again . ????? why why????? How can I avoid that, s_time and e_time are numbers in database, this is the query I'm using

Thanks Zed

$query = "SELECT b_id, COUNT(*) AS Cnt 
2.FROM booking 
3.WHERE request_date='$request_date' 
4.AND e_time > '$s_time' 
5.AND s_time < '$e_time' 
6.GROUP BY b_id"; 
7.    $result = mysql_query($query); 
8.    $row = mysql_fetch_assoc($result); 
9.    if($row['Cnt'] > 0){ 
10.    error_message('Sorry, this time is already booked. Please choose another'); 
11.            } else { 

Link to comment
https://forums.phpfreaks.com/topic/171925-select-query/#findComment-909145
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.