In teaching myself php and mySQL a year or two ago, I created a movie database for the theater I work at, to help automate the more mundane web updates that need to be done weekly. So far this only pertains to film information (title, ratings, synopsis, start date) – but does not include showtimes, but lately I’ve thought it might be fun to see if it’s possible to build on this aspect of the site.
My initial idea was to build a table that displayed showtimes via date groups (ie 5/15 – 5/20), but it was suggested that submitting times for individual days would probably be more useful from a user perspective (ie the showtimes for 5/15 are…), especially since there are occasionally changes and cancellations throughout the week due to special events.
Problem I’m having even starting this – is how to submit more than one date at once. Would it be possible, in the form, to have a ‘start date‘ and ‘end date‘ and have the single form submit all the times input on those two dates and all the dates inbetween?
From a back-end perspective submitting the same 4 or 5 showtimes every day, 7 days a week for 10 to 14 films a week is more work for US than just putting the times in manually in dreamweaver – so I’m just trying to figure out how to make the process easier for us behind the scenes. If we could batch insert a set of showtimes, then we could go back through and edit the individual days that have special/cancelled times (which would probably mean building in a ‘draft, live, hidden’ system – but I’ve got at least a basic knowledge of how to go about that.
I’ve got a very basic table set up for showtimes with (user end example of what I’m aiming for here):
- MOVIE_ID (links with the movie info database to pull in film info – title, runtime, etc)
- sched_date (uses datetime to set a specific showtime on a specific date)
I guess I might have to abandon using datetime if there’s any way to do this?
Any help would be hot! Much thanks!
You can have 2 date fields with names
from_dateandend_datein your PHP form. In your PHP form submit code you then need to use the DateTime class and start fromfrom_dateand use the DateTime::add method to loop tillend_dateis reached. Please note you need to first convert the 2 dates i.e.from_dateandend_dateto datetime using either new DateTime(‘YYYY-MM-DD’) or using DateTime::createFromFormat.In the loop simply send insert commands to MySQL to insert the rows to your DB.