Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7878969
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 3, 20262026-06-03T03:47:57+00:00 2026-06-03T03:47:57+00:00

I have problem thinking this trough with PHP & Mysql . I have read

  • 0

I have problem thinking this trough with PHP & Mysql. I have read How to implement check availability in hotel reservation system and some more but they seem different.

I have to make a reservation system on which a converence room can be booked for 6hours minimal, so when a user make a reservation on a date e.g 24/04/2012 he then selects the start time of the rental (00:00-06:00, 06:00-12:00, 12:00-18:00,18:00-24:00). And the total number of hours(6,12,18 etc..) the user wants to rent the room.

The date is stored as a integer(timestamp).

I have two problems with this; I don´t know how to receive all possible days of a month on which the room is still up for reservation and how to check if a new reservation is possible.

I know how to calculate the start date and end date on the users input but I cant find the correct mysql query or php check for availability.

It’s probably really simple but somehow because the end date is always variable I just cant find the answer.

Thanks in advance guys!

EDIT Table structure: reservations

id  int(11)         
user_id int(11)     
reservation_name    varchar(255)    
start_date  int(11)         
end_date    int(11)         

I believe reservations is the only one relevant

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-03T03:47:58+00:00Added an answer on June 3, 2026 at 3:47 am

    You’ll find it’s pretty difficult to generate a list of available days in MySQL. I recommend instead that you select an ordered list of booked days within your desired month, then loop over all days of that month in PHP skipping the day if it matches the next booked day from your MySQL query. The answer to this question will help you to build the dates over which you want to loop in PHP. In pseudocode:

    $booked_days = sql(select all booked days in month order by day);
    for each $day in month {
       if $day != current($booked_days) {
          // $day is not booked
       } else advance_next($booked_days);
    }
    

    To check if a new reservation is possible, you might want to have a look at my answer to a very similar question earlier today.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a chicken-egg problem. I would like too implement a system in PHP
This is more thinker than problem. I have a problem with thinking about how
I've been thinking about this problem for a while and have yet to come
I was thinking of a solution to this problem. My input: 1. Have a
I have problem with Android using the class HttpUrlConnection my method is this: public
I have problem compilin this code..can anyone tell whats wrong with the syntax CREATE
Ok so this one is strange and I'm thinking there must be a problem
UPDATE & SOLUTION : Everyone, for whoever has this problem in the future, I
I have few queries related to read()/pread() system calls in a multithreaded environment I
Can someone assist me in thinking my way through this problem. In the code

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.