Jump to content

Creating a PHP/MYSQL Scheduler - HELP!


itstooloud

Recommended Posts

Hello,

 

I am new to this place. I am just trying to find someone that can shed some light or provide some guidance for what my brain can't seem to sort out.

 

What I am trying to do is create a schedule that will block off times that are already booked, as well as color code a small calendar depending on whether there are AM or PM openings. I managed to create a working edition, but I took the easy route of making the time in 30min intervals and creating a column for each time (0800, 0830, 0900, etc) in the DB.

 

Now I need to create it allowing ANY time to be booked for ANY interval. I have an idea as to what needs to be done, I am just not sure how to go about doing it.

 

What I set-up was a table with the technicians names and times they can work that day. It simply had a column for name, column for start time (datetime field) and column for finish time (another datetime field).

 

Then I had a bookings table with many columns for different fields to do with the booking, but it also had a field for the name and start/finish datetime columns.

 

What I think I need to do is run a query first to grab the time range that someone is available that day. Format it somehow into a PHP array. Then look at the existing bookings and find the time free between the booking and the available hours using PHP. Display a color if there is availability in the AM, PM, or both.

 

Then I need to create an HTML table to display the bookings and free time based on the DB info to allow creation of new bookings. Can anyone provide some guidance who has done something similar or would know how to do it? I just need the base of finding the free time between bookings and available hours and displaying a table with such info...

 

Much appreciated.

Link to comment
Share on other sites

Hey.

 

I lost you after the third paragraph, you'll have to explain again or put a link to your page.

 

But for the times and intervals stuff, I'd use timestamps. Like for each shift of each employee or whatever have a DB entry with columns like the employee name or id, the timestamp of when they start work, and the timestamp of when they finish work. You can handle all the specifics of the timestamps with PHP's mktime(), time(), and strftime(). [Look these up in the PHP function reference if you don't know them]

 

Maybe that helps a bit?

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.