Hi Luis,
I am trying to incorporate this calander into a new site I am creating. I have been having problems trying to get events from my database into the calander, that's when I stumbled upon your tutorial. Let me state that I am not using Processwire. I have a php page and I am connecting to a mysql database.
I followed your tutorial and have added all the files and updated the script to add getEvents() function. Here is my part of my code with the getEvents function.
mysql_select_db($database_rsCalData, $rsCalData);
$query_rsgetevents = "SELECT * FROM calendar_events";
$rsgetevents = mysql_query($query_rsgetevents, $rsCalData) or die(mysql_error());
$row_rsgetevents = mysql_fetch_assoc($rsgetevents);
$totalRows_rsgetevents = mysql_num_rows($rsgetevents);
function getEvents() {
$i=0;
while ($i< $totalRows_rsgetevents) {
$month=mysql_result($rsgetevents,$i,"event_month");
if(strlen($month) < 2) { // this is incase only 1 digit was enter e.g. month 5 instead of 05
$month = "0" . $month;
}
$day=mysql_result($rsgetevents,$i,"event_day");
if(strlen($day) < 2) {
$day = "0" . $day;
}
$year=mysql_result($rsgetevents,$i,"event_year");
$title=mysql_result($rsgetevents,$i,"event_title");
if ($i < $totalRows_rsgetevents -1) {
echo "'$month-$day-$year' : '$title'";
} else {
echo "'$month-$day-$year' : '$title'";
}
$i++;
}
}
?>
Right now I only have one record in my database. When I load the page my calander is blank.
I commented out the following lines
//function getEvents() {
and the final bracket of the function //}
So all I had was the while loop. When I reloaded the page my database data was echoed on the page. So I uncommented the two lines of the function and added the following code to the bottom of the getEvents function.
$month="5";
if(strlen($month) < 2) {
$month = "0" . $month;}
$day="1";
if(strlen($day) < 2) {
$day = "0" . $day;}
$year="2013";
$title="Another Small Test ";
$dmy ="$month - $day - $year";
echo "'$month-$day-$year' : '$title'";
I reloaded the page and the above data the "Another Small Test " was added to my calander on the 1st of May 2013 but my database data was not added. So I added some code and compared what was coming from my database and what I just entered above. I reloaded the page and they compare the same.
I am at a loss as to why my data does not get posted to the calander when it is in the correct format, as far a I can assume. Any help would be greatly appreciated.
Thanks Roland