I have been playing around with the buildSchedule.php component of NFL PHP Pick ‘Em as this is the component that makes it all possible to generate tables needed to create the SQL script to import into the new season. My previous post on this subject required a spreadsheet, which never really was necessary. Even though the output filename contains a XLS for the file extension, if it is opened with a text editor, it can be seen that this is actually html tables. The conversion just got easier.
The original buildSchedule.php contains a require to includes that did not make it possible to run via command line. After considerable hacking away at the original buildSchedule.php, I finally have one that will generate a SQL file to import into MySQL.
I would have posted the code into this article but it doesn’t want to display well. Here is an attachment of the PHP file.
buildSchedule2.php (3.8 KiB, 583 hits)
Everything is run via command. Just save the php and run it like so.
After executing the file. It will display the output to the screen and generate a nfl_schedule_YYYY.sql file which can be used to replace the contents of the previous year.
As always, use at your own risk. I hadn’t fully tested the script.
THANKS for posting this along with the downloadable .sql file in the other thread. Saved me a LOT of time !! FYI in the .sql file the times for the week 6 & 9 London games are incorrect. They import as 9:30pm instead of AM – was easy fix to correct but some may miss it.
Thanks again !!!