Creating mySQL Calendar DB - RESOLVED
Posted: Sat Oct 25, 2008 5:51 pm
The obvious answer to my question is "Because I'm a dope," but that doesn't help me. 
The URL is: http://calendar.erikastokes.com/
You see how "Sample Event" occurs Wednesday - Saturday on every non-first week? It's only supposed to show up on Wednesdays. It is a single record in the database.
I had it working, sort of, and then I decided I was writing the same code twice (I have two functions to display the first week vs. the 4th-6th weeks of a month... yes, some months have days within 6 separate weeks), so I decided to put it in a function, findprintevents(), which is the last function in functions.php.
I've had a one-semester course in PHP which didn't include any mySQL, I learned all of that on my own, piecemeal, so my knowledge is spotty. Any suggestions as to why this event is appearing 4 days a week instead of 1 or suggestions on how to improve my code (without getting overly complex), would be appreciated.
This is a project on my own that I'm trying to develop because I have a few sites on which I'd like to place calendars, not a homework project, so you're not doing my homework for me.
But I DO want to further my PHP education, which is why I'm writing it myself instead of using a pre-written solution.
I couldn't get the forum to allow me to upload the scripts, so they are available here:
http://calendar.erikastokes.com/login.php.txt
http://calendar.erikastokes.com/functions.php.txt
http://calendar.erikastokes.com/index.php.txt
http://calendar.erikastokes.com/install.php.txt
The install.php script, if run on a server on which there is a database (and assuming you have the $databaseinfo[] array available to it by creating it in login.php), will create a table and populate it with one sample event. The event is created for the day the script is run. You can edit it to be just recurring/Wednesday, but you should set the date/month/year fields to null. The script drops table "events" before creating it -- so don't let it delete anything you might have installed!
Thanks for any help.
The URL is: http://calendar.erikastokes.com/
You see how "Sample Event" occurs Wednesday - Saturday on every non-first week? It's only supposed to show up on Wednesdays. It is a single record in the database.
I had it working, sort of, and then I decided I was writing the same code twice (I have two functions to display the first week vs. the 4th-6th weeks of a month... yes, some months have days within 6 separate weeks), so I decided to put it in a function, findprintevents(), which is the last function in functions.php.
I've had a one-semester course in PHP which didn't include any mySQL, I learned all of that on my own, piecemeal, so my knowledge is spotty. Any suggestions as to why this event is appearing 4 days a week instead of 1 or suggestions on how to improve my code (without getting overly complex), would be appreciated.
This is a project on my own that I'm trying to develop because I have a few sites on which I'd like to place calendars, not a homework project, so you're not doing my homework for me.
I couldn't get the forum to allow me to upload the scripts, so they are available here:
http://calendar.erikastokes.com/login.php.txt
http://calendar.erikastokes.com/functions.php.txt
http://calendar.erikastokes.com/index.php.txt
http://calendar.erikastokes.com/install.php.txt
The install.php script, if run on a server on which there is a database (and assuming you have the $databaseinfo[] array available to it by creating it in login.php), will create a table and populate it with one sample event. The event is created for the day the script is run. You can edit it to be just recurring/Wednesday, but you should set the date/month/year fields to null. The script drops table "events" before creating it -- so don't let it delete anything you might have installed!
Thanks for any help.