Quick Calendar Using AJAX and PHP

Online calendars are often used in many web applications. Though popular, the logic behind creating a calendar can be scary especially for those who are new to programming. There are many web calendars in the market but some of them are quite complicated. If we are not able to understand the code, it becomes harder for us to customise the calendar to fit into our existing application. As such, we need to create a calendar that can plug itself into any system seamlessly without problems. Whether we are using Wordpress, Mambo/Joomla or Drupal, we should only need to insert one line into our code for the calendar to work. ie something like this:

<?php
require_once('quick_calendar.php');
?>

If you are already bored at this point or not interested to know how to create a web calendar, feel free to see a live demo of the simple calendar here. The installation procedures is in the source code.

Other than configuring the database access for the calendar, I do not want to change other things. With AJAX, I could even make the page static as I navigate between different months in the calendar. In this tutorial, I would like to share with you a simple calendar I created that fufills the objectives discussed above. The tutorial assumes that you have basic knowledge of PHP and SQL but don't worry, the actual code is minimal and you should be able to customise it easily by reading at the comments. I used PHP 4 so that it is compatible with most servers. You should also be able to re-create the calendar easily in other programming languages using the same logic.

The First Step: Problem Identification

Perhaps the hardest part in creating a calendar is to come up with a good solution to display the days of the month in the correct column, ie Monday, Tuesday..etc.

Apr 2006
SunMonTueWedThurFriSat
            1
2 3 4 5 6 7 8
9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 28 29
30            

Let us take April 2006 for example. There are 30 days and 6 rows in the calendar. If we are given a day in the month, say 15, we have to know that it falls on a saturday and is in the third row (third week). We cannot take for granted that the first day is always the first cell in the table (top left cell). Sometimes, we get 4 or 5 weeks in a month. Only if we know how many days are there in a certain month and which day the first of the month falls in only can we construct the calender as shown above.

Getting Crucial information From The PHP Date function

PHP provides a date() function that gives us alot of useful information about the days and months of the year. To built the calendar for any month, We need 2 important pieces of information from the Date function, ie the "number of days in the month" and a "numeric representation of the first day of the month".

I can get today's date easily from the following code:

// get year, eg 2006
$year = date('Y');
// get month, eg 04
$month = date('n');
// get day, eg 3
$day = date('j');

To get the number of days in this month, I will use the both the date and mktime function like so:

// get number of days in month, eg 28
$daysInMonth = date("t",mktime(0,0,0,$month,1,$year));

The numeric representation of the day of the week ranges from 0 to 6. 0 is sunday and 6 is saturday. Again, to get the numeric first day of this month, the function mktime comes in handy.  

// get first day of the month, eg 4
$firstDay = date("w", mktime(0,0,0,$month,1,$year));

The Monthly Calendar As A 2-D Array

If we look at the calendar again for April 2006, we will see that it is actually a table(grid) filled with values starting from 1 to x (no of days in the month). The first day of the month is a variable though... It can occur in any day of the week. In the table, imagine each cell as having coordinates (x,y), starting from the top left cell as (0,0) and the bottom right cell as (5,6). In the month of April, the first day of the month is stored in coordinate (0,6). So, the plan now is to store the days of the month in a 2-D Array. 

Firstly, we want to know the number of cells needed. 

// calculate total spaces needed in array
$tempDays = $firstDay + $daysInMonth;

Then we want to know the number of rows needed.

// calculate total rows needed
$weeksInMonth = ceil($tempDays/7);

Populating The 2-D Array

Knowing the number of rows and columns in the 2-D array, we can now fill the arrays with values using 2 for-loops. The first cell will start with a value of 1 and the subsequent cells will have their values increased by 1 till it reaches the end of the array. 

<?php
for($j=0;$j&lt;$weeksInMonth;$j++) {
    for(
$i=0;$i&lt;7;$i++) {
       
$counter++;
       
$week[$j][$i] = $counter;
    }
}
?>

For the month of April, the temporary array should be something like this:

 3  6 7
8 9 10 11 12 13 14
15 16 17 18 19 20 21
22 23 24 25 26 27 28
29 30 31 32 33 34 35
36 37   38 39   40 41   42

The Magic Offset

As you can see, the array above is not correct. The first day of April, ie value 1 should be in (0,6) instead of (0,0). Remeber the variable $firstDay? It is the numeric representation of the first day of month which happens to be 6 in April 2006. If we subtract  $firstDay from all the values in the array, we will get the array as follows:

-5 -4   -3 -2  -1   0 1
2 3 4 5 6 7 8
9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 28 29
30 31  32  33  34  35  36 

You should now be able to guess what we are going to do next. Looking at the array above, you see that we already got the values we want but we also have some unwanted values. Any number less than 1 or more than $daysInMonth (number of days in a month) should be ignored.

<?php
   
function fillArray() {
       
// create a 2-d array
       
for($j=0;$j<$this->weeksInMonth;$j++) {
            for(
$i=0;$i<7;$i++) {
               
$counter++;
               
$this->week[$j][$i] = $counter;
               
// offset the days
               
$this->week[$j][$i] -= $this->firstDay;
                if ((
$this->week[$j][$i] < 1) || ($this->week[$j][$i] > $this->daysInMonth)) {   
                   
$this->week[$j][$i] = "";
                }
            }
        }
    }
?>

This is the core function in the entire calendar generation algorithm.

Displaying The Calendar

Getting the values right in the 2-D array, we are now ready to display them. Now, we will create a table and start looping again using the foreach function.

<table width="400" border="1" cellpadding="2" cellspacing="2">
<tr>
<th colspan='7'><?= date('M', mktime(0,0,0,$month,1,$year)).' '.$year; ?></th>
</tr>
<tr>
<th>Sun</th>
<th>Mon</th>
<th>Tue</th>
<th>Wed</th>
<th>Thur</th>
<th>Fri</th>
<th>Sat</th>
</tr>
<?php
foreach ($week as $key => $val) {
echo "<tr>";
for ($i=0;$i<7;$i++) {
echo "<td align='center'>$date</td>";
}
echo "</tr>";
}
?>
</table> 

The final display will be like this:

Apr 2006
Sun Mon Tue Wed Thur Fri Sat
            1
2 3 4 5 6 7 8
9 10 11 12 13 14 15
16 17 18 19 20 21 22
23 24 25 26 27 28 29
30            

We now have a plain calendar.

Adding Special Dates To The Calendar

This calendar only tells you "the days of a week" at the moment and is not very useful. Most online calendar will have reminders as well. Say for example, if my birthday falls on the 4th of April, I want the number 4 in the calendar be displayed differently, possible with a hyperlink in which upon clicking on it, will perform some task like redirecting me to a certain page or displaying more information about myself in a popup windows..etc. To do that, we need to a table in the database with at least 6 columns: id, day, month, year, link, desc.

CREATE TABLE calendar ( 
id INT NOT NULL AUTO_INCREMENT ,
day VARCHAR( 2 ) NOT NULL ,
month VARCHAR( 2 ) NOT NULL ,
year VARCHAR( 4 ) NOT NULL ,
link VARCHAR( 255 ) NOT NULL ,
desc TEXT NOT NULL ,
PRIMARY KEY ( id ) );

We then need to insert some data into the table for testing:

INSERT INTO calendar ( id , day , month , year , link , desc ) 
VALUES (

'', '24', '*', '2006', 'http://www.sitecritic.net', 'Check your web cccount on the 24th of every month. 2006 only!' ), ( '', '5', '11', '2006', 'some_javascript_funtion', 'Olympics, remember to buy ticket from alice.' ),( '', '2', '1', '2007', 'some_javascript_funtion', 'early 2007. Any new plans for the year?' ), ( '', '9', '*', '*', 'http://www.evolt.org', 'Remember to check updates from evolt.org every month.' );

The * under the month or year column means every month or year.

Next, we do a query and extract the important dates for a certain month and store it in an array.

<?php
$sql
= "SELECT * FROM calendar WHERE (month='$month' AND year='$year') || (month='*' AND year='$year') || (month='$month' AND year='*') || (month='*' AND year='*')";
$rs = $db->query($sql);
while (
$rw = $rs->fetchRow()) {
   
extract($rw);
   
$links[] = array('day'=>$day', 'month'=>$month, 'year'=>$year, 'link'=>$link, 'desc'=>$desc);
}
?>

If we create a class to generate the calendar, we need to pass the $links array into the class like so:

<?php
$cal
= &new Calendar($cArray, $today, $links, $css);
$cal->render();
?>

The $cArray is a class containing the array for the plain calendar as shown in step 6. The $today variable is today's date. The $links variable contains the important dates in this month. With the $css variable, we can decorate the calendar table and make it look nicer.

Adding AJAX Capability

To make the calendar more user friendly, we want to be able to navigate easily between the months or years without refreshing the page. Thanks to AJAX, we can now do that easily. If the user clicks on "next month" for example, we need to call the AJAX function to refresh the calendar without refreshing the page. We do that using XMLHttpRequest. This is the main code that does the trick.

http.open('get', 'quick_calendar.php?m='+m+&y='+y+'&ran='+ran_no);

After I get a response from the AJAX function, i need to update the calender. The calendar is wrapped around with the div tag called 'quickCalender'. I just need to rewrite the contents of the tag on the fly.

document.getElementById("quickCalender").innerHTML = http.responseText; 

Conclusion and Future Improvements

In this tutorial, we went through the concept of how to create a web calendar using AJAX and PHP. I left the details in the code to prevent the tutorial becoming too long and indigestable. If you look at the code hard enough, you will notice that I packed alot of codes in one file. As a good programming practice, I should have broken them down into smaller parts/files. Because the objective of this project is to create a quick "plug and forget" calendar system, I did that on purpose.

Also, the object oriented approach I used in the code may not be flexible enough if I want to have different layouts for the calendar. The problem can be easily fixed by using inheritance, ie creating a superclass for the QuickCalendar class. We can then have BrownCalendar, SpecialCalendar ...etc.

Hope you enjoy reading this tutorial as much as I wrote it. The full demo can be seen here and source code is here.

Comments

dcal

dcal is a PHP calendar I wrote a few years ago. It will display any year or month from 1970 to 2037 and includes holidays, moon phases, the vernal and autumnal equinox, summer and winter solstices, and some other goodies including a slick JavaScript slider interface for jumping directly to a particular month.

Hi Bernard, just so you know

Hi Bernard, just so you know the source code and the demo links appear to be broken.

Great Article

Great article Bernard. Although there are many perfectly decent calendar apps already out there made by the big guys, it's nice to follow along the creative process. And it seems the URLs are fied now. Regards Dave

There's a problem...

If you are in December and try to navigate back one month then the year gets incremented as well e.g. moving from Dec 06 to Nov 06 actually brings up Nov 07.

changes to the script

thanks all esp daibach for pointing out the error, I've updated the script: php calendar. I emailed the admin with the changes but it wasnt updated. I did a typo with the link in the first paragraph. The link in last paragraph is fine.

there is also an extended version http://web-developer.sitecritic.net/quick_calendar_demo2.php

the source code is http://web-developer.sitecritic.net/quick_calendar.txt

Good script. On your

Good script. On your website, on the simple version, there is still errors if you go back and froth a couple of time between dec 2006 and jan 2007. On the extended version, there is no problem. One advice, even thought this is not the point of the article, for accessibility reasons, you should remove the hre f = "java script:; "(errors only for evolt filter) and replace it with the ajax function, eg: hre f="quick_calendar2.php ? m=11&y=2006"(errors only for evolt filter). You will only have to change a bit the php code to find a new way to send only calendar html code for your ajax functions (i.e. your already there random var?).

thx for your script.but your

thx for your script.but your source code up there are not like your extended version. and i try to change like gichenoubi said but it still doesn't work for me. i'm the newbie in ajax

Some quickCalendar fixes

1. To fix the Jan->Dec problem in the "simple" version: In createHeader(), in elseif ($prevMonth==0){, need to add the forgotten statement $prevMonth=12;

2. The "jumpiness" of dates in calendar body when changing month to month is fixed by css changes:

td {height: 22px; border: 0px;
.today and .link {padding: 1px;
Jumpiness of the entire page is improved by setting weeksInMonth (in CreateQCalendarArray) to 6 (this sometimes leaves a blank bottom week, but it keeps the rest of the page from jumping).

3. I found it necessary to initialize the links[] array to '' prior to filling it in the "while mysql_fetch_array" loop, to avoid empty array errors at the foreach loop in createBody. Don't know why this isn't a problem for the posted demo.

4. Each next/previous month or year causes the entire css to again be written to the page, making the page increasingly large (to see this, save the page and examine in an editor). Here's a fix: Place css in quick_calendar.css; in function createHeader, read in the css within the "class=calendar" table with fread:

$this->html = "<div id='quickCalender'><table cellspacing='0' cellpadding='0' class='$this->css'>";
$this->html .= fread(fopen($this->cssfile,'r'),filesize($this->cssfile));
$this->html .= "<tr> ... "

(where $cssfile='quick_calendar.css', passed to function QCalendar through added parameter cssfile; in QCalendar, $this->cssfile=cssfile).

5. Along with quick_calendar.txt (the "simple" version), it would be nice if Bernard would post quick_calendar2.txt for the "advanced" version. (I have done my own; I'd like to compare notes.) It would also be nice if Bernard would fix the erroneous "we-developer" links on this page.

Some quickCalendar fixes - continued

6. Every change of month or year creates another <div></div> around the calendar. (To actually see this, use FireFox with Firebug and set Outline Blocks.) To avoid this, remove <div...> from $this->html = "<div...> in createHeader(), and remove </div> at the very end of createFooter(). To place a calendar on a (.php) page, surround the php with a div:

<div id='quickCalendar'>
  <?php  require_once('quick_calendar.php');  ?>
</div>
(This is only slightly less "quick" than the php-only statement.)

7. Also, throughout css, "a:link" should be "a.link" (Now I can get rid of those underlines!)

Starting with Mondays

You can easily update this script to start with Mondays (therefore having Sat and Sun together at the end of the table) by changing:
<th>Sun</th>
<th>Mon</th>
<th>Tue</th>
<th>Wed</th>
<th>Thur</th>
<th>Fri</th>
<th>Sat</th>
to...
<th>Mon</th>
<th>Tue</th>
<th>Wed</th>
<th>Thur</th>
<th>Fri</th>
<th>Sat</th>
<th>Sun</th>
and adding:
<?php
// Start with Monday
if($firstDay == 1){
$counter = 1;
}
?>
before the
<?php
for($j=0;$j<$this->weeksInMonth;$j++) {
  for(
$i=0;$i<7;$i++) {
   
$counter++;
    ...
?>
loop Simple! Ed.

message for kirk837

Thanks Kirk,
your suggestions have made a difference in the calendar. I also figured out how to implement a message when you hit the calendar date. However in my calendar I increased the size of the width of the calendar to 600 or 700px. Take a look http://www.global-crafts.org/about/events.php. My implementation for the message was just to pass the id and make a query to the database. I set a boolean so I would know which mysql command to execute. When I got the output from that I would send it back. One thing that kept happening to me for a long time was that I didn't remove a div at the end of the table. I don't know if I did that or it was from the original code.
If I have time I will post my code in the near future.
Laters.

thanks for the suggestions

thanks kirk for going through the script thoroughly. I've added ur name to the comments as a contributor. you pointed out a serious error, that is the reloading of style sheet and javascript when the user navigates the month or year. As i want to make the script plug and forget, ideally, we would only want one single file and one line to implement the calendar... therefore, i've added an extra line before the style sheet and javascript to check for a GET var called via ajax. If the var exist, i dont display the style sheet and javascript. With this change, I can ensure that the stylesheet and javascript are only called once. (I've updated the source code - see it and it should be obvious)

with this, only the calendar will be re-rendered. I am not too sure about the jumpiness display... as it all seems to look ok in my browser. anyway, i guess this is a small issue and a graphic designer should be able to fix it easily. With regards to the advance version, it is really nothing spectacular. I just added another ajax function and div tag for it reload the contents when the user clicks on the links. I have some ideas to improve this script further and will post some updates if have time. thanks everyone again for giving suggestions to improve this script.

Peace out, Bernard

* I've already emailed the admin about the wrong link in this article, ie we-developer.sitecritic.net should be web-developer but they doesnt seem to have time to read my mail. i also realised alot of people are starting to abuse this site with spam links.. again they are not doing anything..

unable to navigate calendar

Nevermind this question. The AJAX code was pointing to the wrong calendar PHP file and after fixing it, the navigation works now. ====================== For some reason, after uploading the code and everything, the calendar shows up, but the navigation between months does not appear to work. I have attached the code snippet that I copied from the demo to try to make it work.
<p><strong>Quick Calender Demo Using PHP AND AJAX</strong> (Advanced Version) </p>
<p>By adding more ajax, we can create more magic! </p>
<div style="float:left;">
<?php
require_once('quick_calendar.php');
?>

</div>
<div id='calendar_details' style='float:right'></div>
<p></p>
<div style='clear:both'></div>

Recurring events

Great script, I've modified it to allow recurring evens, let me know if anyone needs this and I'll try and post what I did.

Cheers G

Recurring events and Monday hack

==> sumogray
I really would like to se how you done the recurring events.
==> a1phanumeric
The monday hack doesn't work. Dont know if it's because the code has changed since you posted it. Anyone know how to get it to work?

Cant get database links to display

Im not sure if anybody else is having the same issue, i tried both the normal and extended version, i input a date on the database but the link will not show up on the calendar, any ideas, very nice tutorial by the way :)

Extended code?

Hey.
First off, very nice code! Well done!
Secondly, how would one get access to the extended version?
I'm making a site (obviously) and the client wants to have a calendar to hold events and such... but there's no links to other sites in it.
I just want to know how to get AJAX to display the content from MySQL just like the extended version

Thanks in advance for help.

Button Problem

Hi, Sorry if this is a duplicate question, i not sure whether my last message has been posted. I have managed to get the calendar displaying on screen, and have added the buttons on some of the dates to navigate to specific pages. Easy. However i cannot use the buttons to navigate the calendar itself, i do not know what the problem is. Sure it must be something simple that i am just not seeing. Any suggestions or help would be much appreciated. Cheers Pidgeley

Calendar navigation

I found that if I replaced this (in displayQCalendar(m,y)):

<?= $ajaxPath; ?>

with this:

<?php print $ajaxPath; ?>

the navigation worked. Now I can't work out how to use the cDisplay function. When I click a link I get a second instance of the calendar.

It might be a leading zero

Great script. Thanks

Navigation doesn't Work

Hello ppl, and thank's to Bernard and everyone who helped making this script. I have a slightjy problem, my navigation doesn't work, and keeps giving me an error in counter++. Can anyone give me a hand in these two functions? function fillarray() gives the $counter++ error and function displayQCalendar(m,y) doesn't permit navigate. thank you very much.

Navigation now works

Hello again,

My navigation links now work, but keeps giving an error in $counter variable:
PHP Notice: Undefined variable: counter in c:\Inetpub\wwwroot\portugalrentalcottages\script\quick_calendar.php on line 233

Has anyone had this problem before? Thank's again

Great Script, I am trying to

Great Script, I am trying to integrate it into a directory using phpLD script.. If successful, I will blog about this.

By the way, ==>> sumogray, Can you please share the modification required to make it recurring? Help will be really appreciated.

the url for demo and source code can't work

hi bpeh, the url for demo and source code can't work at all, can you correct it? Thanks.

I tried to get this script

I tried to get this script running, but somehow it is only returning a empty table! Any clue what this could be?

Hi Bernard Pen... Wonderful

Hello Bernard Pen... Wonderful script, I am going to try installing the script to test few things, I will post soon again on this soon.

Thanks for the script

Love the quick AJAX calendar script.Going to try it out on my Wordpress blog the next time I update it.

Not working here either

Does anyone have a copy of this script that actually shows the event dates properly? I get a calendar, but the four example events show up at the beginning and end of the table without links/dates. My attempt using the supplied code: http://www.mgwebservices.ca/ripley/index.php cheers, Mark

A certain burger chain would

A certain burger chain would say: "I'm loving it" (and I agree!) I will be implementing this into my network of car rental websites with one of the upcoming updates. Thanks for the article!

ASP version

I have several sites that would benefit from having this sort of calendar. Unfortunately, they run on Windows/IIS, so I guess I will have to look into converting the script to ASP... But thanks for the head start! :-)

recurring events

sumogray, are you still around? I'm VERY interested in how you managed to get recurring events to work. In fact, what I'm struggling with is how do I make this so instead of just making the date/number a link if there is an event, I want to list an event title for any and all events right on the date as a link to the event description. Of course I want the possibility of more than one event per date as well. I'm really struggling... any suggestions? Here's a link to my implementation so far. http://utahcustody.com/members/newtestcalendar.php

Monday, bloody Monday

thanks for the script. i like it.

i need to make the week start on a Monday. this seems to be working for me:

In the CreateQCalendarArray function, after

$this->firstDay= ...
, insert

$this->firstDay -= 1;
if ($this->firstDay< 0) {
$this->firstDay =6;
}

Code for advanced version

Is the code for the advanced version available? I've been trying for a few hours but i can't seem to get something like that working.

Thanks! - Souce code for Advanced Version?

Hi, This is an amzaing piece of work; thank you very much. Any chance you could make the advanced source code available? I would love to know how to allow individual events to display in divs like you are doing there. Thanks; Mike

Great article, wonderful

Great article, wonderful script, Thanks. Mike

Adding Calendars

Is there a quick way to display 12 tables for the whole year at once?

Nevermind

I figured out the multiple calendars question, I missed the render statement at the bottom. However the links to next and prev months and years do not work.

Nice to follow your creative

Nice to follow your creative process and teach some lessons in advanced coding. regards

Advanced

Thanks for this article. It's an interesting starter to AJAX too.

iexplorer symtome at months navigation << ><<

hi I made the usefull calender in a column at the top right of my page in my local web aplli generaly i use firefox all seems to be fine the calender was exellent i used iexplorer to see the render at first the page looks correct but after month navigation at my surprise ,thre is a bad rendering when i use iexplorer try it!!! i put it in a div and i cant detect whats happen with it a blanc area apear

I get an error

When I use the code supplied here, I get the following error:

Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /link/to/calendar/quick_calendar.php on line 90

(link/to/calendar is fictional, but correct in the code).

Oddly, the calendar still displays and is fully functional below this error.

In the actual code, the following line appears:

while ($rw = mysql_fetch_array($rs)) {

However, in the author's breakdown above, that same line appears as:

while ($rw = $rs->fetchRow()) {

Unfortunately, when I change the code to the latter, the calendar completely breaks.

Any suggestions as to what the problem could be? My server is using PHP 4.4.6, MySQL 4.1.22-standard, and Apache 1.3.37 on a Unix box.

Working nicely

Hi, I have gone through your script and would like to thank you for the start in getting it going. I have not come across many of the problems you have, however it has taken me a little while to work out how to do it myself using your code as a framework.

Just a question and some notes if I may;
Q: why do you not put the (php) calendar creation script in a seperate file, I found this to be much simpler and negates the need for any rand variables. i.e.
  • main.php (displaying calendar, include js and css in here once only);
  • calendar.php (calendar creation class);
  • getCalendarData.php (accepts $m and $y vars, includes calendar.php for calendar creation and then return the table to the ajax function for insertion into the div);
  • calendar.js (the ajax stuff, calls getCalendarData.php);
  • calendar.css (the calendar formatting)

  • Notes:
  • I generated the $today timestamp once and used it throughout.. just simplifies coding for me, but no difference in working.
  • Instead of using the title for the description, I found a tooltip php code (http://www.walterzorn.com/tooltip/tooltip_e.htm) that allows me to just specify 1 include of js and then I can use a function called Tip() in the mouseover of the date to display things. Also allows me display multiple entries per day. the tooltip is fully configurable.
  • I am unsure why you created the array creation as a sepearate class? I just added it as a function to the calendar class.

  • I have not yet perfected the code, it is still work in progress, but its working ok, no issues as such yet.
    I have found a (very nice) XMLHttp creation function which runs through all the objects available..
    function createXMLHttp() {
      if (typeof XMLHttpRequest != "undefined") {
          return new XMLHttpRequest();
      } else if (window.ActiveXObject) {
        var aVersions = ["MSXML2.XMLHttp.5.0",
                         "MSXML2.XMLHttp.4.0",
                         "MSXML2.XMLHttp.3.0",
                         "MSXML2.XMLHttp",
                         "Microsoft.XMLHttp" ];

        for (var i = 0; i < aVersions.length; i++) {
          try {
              var oXmlHttp = new ActiveXObject(aVersions[i]);
              return oXmlHttp;
          } catch (oError) {
              //Do nothing
          }
        }
      }
      throw new Error("XMLHttp object could be created.");

    }
    full article on the above at http://www.wrox.com/WileyCDA/Section/id-291289.html
    Finally, you are welcome to check a demo of my calendar at http://www.crasha.com/index.php (Jan 2008 contains some data)..... do not trying browsing anywhere (content) yet though, still creating the website :)
    Ciao

    Almost working - but there is a strange problem

    This is a great calendar for my purposes - and I thought I had it working great in December 2007, when first installed - it was picking up all the db entries (events in the db for each day of that month and for Jan 2008) and creating links in the calendar for December - however, there were no links for Jan, 2008. When I added events to the db for Dec 2008, hey presto, we had a link for that event in the Dec 2008 calendar. Further testing shows that my calendar will only show links for the months of Oct-Nov-Dec in any year - even though I have db entries for every month - anyone have a clue as to what is happening here? I have messed around with the code to no avail (I'm no expert!)and am stumped. I am running Linux/PHP 4.4.4/MySQL4.1.22-standard

    Calendar doesn't advance?

    calendar displays well, but it doesn't advance to next or previous month and year? I basically copied your source code and pasted it, set up the database(which works well) and I get the calendar! just not advancing? can someone help? thanks!

    Calendar doesn't advance!

    works now! just had to change one line of code in the function displayQCalendar(m,y)
    <?= $ajaxPath; ?>
    change this to
    <?php $ajaxPath; ?>
    and it worked, awesome work! thank you!

    ajax

    Is there anyone who could explain how we can get ajax to display the description. Each time I tried it only showed me another instance of the calendar. thx.

    Admin area

    Hi, How can it be modified so if a session variable is set, have all the days linkable to a form allowing events to be added to the calendar else if session variable is not set show standard events calendar? Thanks

    Would it be that you are

    Hi axelotl, Would it be that you are storing day or month in the database as say 03, 05 rather than 3, 5?

    List of Events

    Great Calendar works perfectly. Just one question.
    Is there a way to display a list of the events in the current month below the calendar and have it update as you move to the next month?

    Impressive demo

    was wondering if you could provide a zip of your calendar version? thanks in advance contact me at my username at google mail .com