Trouble with a Calendar Script
Posted by Chris_Isaac (Chris Isaac), 28 February 2007Hi
I'm having a bit of trouble getting a calendar script to work. I can get it to print out correctky, but what I would like is to tie it to a musql database, so if for example there is an event in the database for 1st april 2007, the 1st would be highlighted as a link, but if no events are on no link would be there.
So far the calendar is working on its own, also I can get the information out of teh database, but can't seem to do both at the same time
Here is the calendar script:
The mysql database/table has 3 fields, ID, Date and event,
I've put where I think I need another IF statement, what I don;t know is how to compare the date from the calendar to the date in the datebase , any pointers gratefully received?
Posted by admin (Graham Ellis), 28 February 2007Chris, I'm feeling pretty tired at the moment and that's a lot of code for a Wednesday afternoon.
I've been asked (as it happens) to work on a calendar example with my class tomorrow - not your code directly but I SHALL be coming up with a calendar handling example that has links on som edays but not on others - worked on one recently that related to hotel availability, funnily enough! I'll come back and post a follow up
Posted by Chris_Isaac (Chris Isaac), 28 February 2007That would be great, thank you.
Posted by admin (Graham Ellis), 1 March 2007What I desribed as my "hot diary" script is here ... and you can run it from there too. Looking at it v your question I'm not really sure it will help much - although I do have a modified varient that passes a parameter into each day cell and colours it depending on room availablility. The code for THAT is - err - contorted and something I'm not proud of.
Posted by Chris_Isaac (Chris Isaac), 6 March 2007Hi Graham,
Firstly thanks for posting this and sorry for the delay in responding, been up to my neck in it last few days.
Haven't had a good chance to have a play with this script, but hopefully (once kids are in bed) will do tonight
I think I've narrowed down where I'm stuck, in the loop :
What I think I have to do is for each date look and see if there is an equivelent date stored in the mysql database, if so make that number a hyperlink to execute the query of bring up the event details for that date.
Will let you know how I get on.
Posted by admin (Graham Ellis), 7 March 2007Like you, Chris, rushed off my tootsie! I note you'll report back ... yes, please do. I have a Perl course tomorrow, sandwiched between Dilton Marsh Halt at 06:27 and a phone call from a top civil servant in the evening. A long story ...
Posted by bschultz (bschultz), 19 March 2007I have a (somewhat) related question. I have a form that needs a dropbox showing the next 7 days, converted from this format: "2007-03-19" to this format: "Monday, March 19".
That didn't make much sense, did it? Let's try again.
The dropbox has Monday, March 19, but when it writes the value to the form field it would be 2007-03-19.
Drop Box Value Written
Monday, March 19 2007-03-19
Tuesday, March 20 2007-03-20
Wednesday, March 21 2007-03-21
Thursday, March 22 2007-03-22
Friday, March 23 2007-03-23
Saturday, March 24 2007-03-24
Sunday, March 25 2007-03-25
Two questions...is that possible, and if so, can someone steer me in the right direction?
Posted by admin (Graham Ellis), 19 March 2007Try this ...
If it's right, here's the source:
Posted by bschultz (bschultz), 19 March 2007Thanks, Graham...that was it!
PH: 01225 708225 • FAX: 01225 793803 • EMAIL: firstname.lastname@example.org • WEB: http://www.wellho.net • SKYPE: wellho