I would like to create a very simple PHP page for a site, which would show a timetable / calendar like data, where each slot would be either free or would have some appointment in it.
Because all the data is actually just one table, something like {month, day, hour, talk_name, talk_description}, I thought why not use a Google Sheets Spreadsheet as the database. OK, the main reason is that I'm just reading books about how to use MySQL in PHP, so I'm definitely not on a level to:
- create a nice admin interface for managing the events
- make the whole thing safe (I mean all my idea about safety is to use .htaccess for an admin folder and make the site read-only elsewhere).
On the other hand everyone could use Google spreadsheets for editing the table, so this way both the security aspects and the UI aspects would be solved.
My question is that how would you recommend me to do that? Google Sheets can both publish in XML and CSV formats. Can I just use fgetcsv
to get the data? Can you give me some simple examples how to parse the csv, and if it would be efficient (ok, it will be less than 50 views a day), if I would do something like this (sorry for the abstract syntax)?
$source_csv = fgetcsv(...);
get_talk_name(x,y,z) {
for all rows in $source_csv {
if (month == x && day == y && hour == z) return talk_name
}
}
get_talk_desc(x,y,z) {
for all rows in $source_csv {
if (month == x && day == y && hour == z) return talk_name
}
}