Jump to content


Photo

php calender and mysql confusion


  • Please log in to reply
1 reply to this topic

#1 s3d

s3d
  • New Members
  • Pip
  • Newbie
  • 1 posts

Posted 20 April 2006 - 03:42 AM

Hi There all

I have a project coming up, which will require something i am not sure how to approach.
Im fairly decent php / mySQL programmer

The project is for a car company which hire out drivers.
So the whole thing will have a load of drivers, who will state their availablity.

Then the admin create a new job, specify the dates, and will show the drivers which are available on these dates.

Short of having a master mySQL calender table (show below) is there a better way?
----------------------------------------
| id      | date             | driverID  |
----------------------------------------
| 1       | 12/02/06       | 6            |
| 2       | 13/02/06       | 6            |
| 3       | 14/02/06       | 6            |
| 4       | 15/02/06       | 6            |
| 5       | 12/02/06       | 2            |
| 6       | 17/02/06       | 2            |
| 7       | 18/02/06       | 2            |
| 8       | 19/02/06       | 2            |
| 9       | 12/02/06       | 7            |
----------------------------------------
Considering the drivers are likly to available alot of the time, and they can shedule lets say 6 months in advanced, this table is gonna get absolutly massive.

Is there a better way?

Many thanks

MAtt

#2 Barand

Barand
  • Moderators
  • Sen . ( ile || sei )
  • 18,021 posts

Posted 20 April 2006 - 05:59 AM

Store the dates when drivers are NOT available (booked)
If you are still using mysql_ functions, STOP! Use mysqli_ or PDO. The longer you leave it the more you will have to rewrite.

Donations gratefully received






moon.png

|baaGrid| easy data tables - and more
|baaChart| easy line, column and pie charts




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users