M
The structure has been chosen terrible. And the table should be one, and the field for status is the same, and the field for the date should be the same: they will always be used in all requests! You will never be required all day of the year, and you will never be required all day of January for all years. One day of one worker must be one line.And what kind of data is to send, there's no difference. For a month, if there is no joint editing of different lasers, the data will be (when the server ' s communications/good work is available) and the client, and the server is identical, and nothing needs to be refrigerated.In addition, to provide a separate table with a production calendar for general weekend/labour days. However, it is true that only distinctions can be stored for workers, linking them to left join. By the way, there are different schedules: five days, six days, three days, two in two, etc.Therefore, at a minimum:Calendar:day_of_year♪ statusCompleted once a year http://buh.ru/calendar/2014/ And the right schedule.Schedule:person_id♪ day_of_year♪ status- differences from the production calendar. Plus unique indexperson_id♪day_of_year)select c.day_of_year, ifnull(s.status, c.status) as status
from calendar c
left join schedule s on
c.day_of_year = s.day_of_year
and c.person_id = $person_id
where
c.day_of_year between $beginofmonth and $endofmonth
insert into schedule (person_id, day_of_year, status) values
($person_id, "2014-04-01", "w"),
($person_id, "2014-04-02", "s"),...
on duplicate key update status=values(status)
Until the violin was seen, I had to register! ♪ ♪UpdatingYou asked for comments on the data structure... If you only show the data, the structure is not important (although I am not a proponent of this approach) you can keep it in the file on a showcase, for example.You'll need ajax:In the processor, get the data to be sent, call. $.post('update.php', data); http://jsfiddle.net/w4rjnr4c/ In the php file, get the data set to process it and record it in the bud.You don't need to update the page. ♪ ♪