[x]
Posted via EE Mobile

Search, ask, and monitor your questions on the go with EE Mobile. Visit Experts Exchange from your mobile device and never be out of touch again.

Question
[x]
Attachment Details
[x]
The Solution Rating System

With so many solutions, how can you tell which solutions are most likely to help you and which ones are not? To provide you with a tool to use, we rate our solutions based on various elements that most accurately determine if a solution is a quality solution. To explain what factors affect the solution rating, here are the elements we take into consideration when formulating our solution rating.

  • The Grade of the Solution
  • The Zone Rank of the Expert Providing the Solution
  • The Number of Author and Expert Comments
  • The Number of Experts Contributing
  • The Feedback of the Community

Your Input Matters
Because of the way the system is set up, the most important variable in this equation is you. As a member of Experts Exchange, you are able to cast your vote on the quality of the solutions in regard to how complete, accurate, helpful and easy to understand each solution is. When you provide your feedback, each rating is adjusted accordingly. So, if you see a solution that has a poor rating that you think is a good solution, let us know by rating it. As you do, the rating will be adjusted and will become more accurate for other members of our site.

If you have any suggestions that you would like to make for our rating system, please ask a question in the Suggestions Zone of Community Support.

Thank you!

6.4

TIMESTAMPDIFF(MINUTE overlapping dates when changing the interval

Asked by ussher in MS SQL Server, MySQL Server, PHP and Databases

Tags: php mysql

bookings are contained in a mysql table.
bookings can only be entered in pre-set intervals.
The user can set the interval, but changes could cause bookings to overlap.

I need to make the php function checkOverlap($interval) to see if the new interval that the user wants to set is acceptable.

EXAMPLE:
current interval is 30 min
bookings in the system currently for  2009-1-16
booking1: 8:00 ~ 8:30
booking2: 8:30 ~ 9:00

The user wants to change the new acceptable booking interval to 60 minutes.  (this will cause the table that displays bookings to create a row every hour instead of every 30 min)

in the situation above changing the interval to 60 min will cause both booking 1 and booking 2 to try to occupy the same cell in the booking table which will break formatting.

checkOverlap() will take the users new desired booking interval and check to see if there are any conflicts.


help appreciated.
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
CREATE TABLE `booking` (
  `booking_id` int(11) NOT NULL auto_increment,
  `booking_starttime` timestamp NOT NULL default '0000-00-00 00:00:00',
  `booking_endtime` timestamp NOT NULL default '0000-00-00 00:00:00',
  PRIMARY KEY  (`booking_id`)
)
 
I think it has something to do with these MySql functions:
SELECT * FROM `booking`
where (TIMESTAMPDIFF(MINUTE, `booking_starttime`, `booking_endtime`) < $interval);
 
and a subquery
[+][-]01/24/09 02:29 AM, ID: 23455865Accepted Solution

View this solution now by starting your 30-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

About this solution

Zones: MS SQL Server, MySQL Server, PHP and Databases
Tags: php mysql
Sign Up Now!
Solution Provided By: ussher
Participating Experts: 0
Solution Grade: A
 
 
Loading Advertisement...
20091021-EE-VQP-81 - Hierarchy / EE_QW_3_20080625