Link to home
Start Free TrialLog in
Avatar of lghaman123
lghaman123

asked on

Strange error message when generating dynamic iCalendar events

I am using PHP to generate iCalendar events using data from a MySQL DB.  To my eye, the .ics file it generates is well formed, but I keep getting an import error that says "This error can appear if you have attempted to save a recurring Lunar appointment in iCalendar format. To avoid this error, set the appointment option to Gregorian instead of Lunar."  I can not figure out what's wrong.  Below is the code, attached is a sample .ics file that this code generates (in txt format due to upload restrictions).  Any help would be appreciated, thanks!
<?php
    header("Content-Type: text/Calendar");
    header("Content-Disposition: inline; filename=sample.ics");
	
	include_once("config.inc");
	include_once("display-functions.inc");
 
	$intTrainingID=$_REQUEST['id'];
 
	$qr="SELECT * FROM tblTrainingClasses WHERE intTrainingID='$intTrainingID'";
	$result=odbc_exec($dbconn, $qr) or die ("Could not execute query...".obdc_errormsg($dbconn));
  	$intUserID=odbc_result($result,"intUserID");
  	
  	$datClassEnd=odbc_result($result,"datClassEnd");
  	$datRequest=odbc_result($result,"datRequest");
 
	$vCalStart = date("Ymd", strtotime($datClassStart))."T090000";
	$vCalEnd = date("Ymd", strtotime($datClassEnd))."T180000";
?>
BEGIN:VCALENDAR<?="\r\n"?>
PRODID:-//Microsoft Corporation//Outlook 10.0 MIMEDIR//EN<?="\r\n"?>
VERSION:2.0<?="\r\n"?>
METHOD:REQUEST<?="\r\n"?>
BEGIN:VEVENT<?="\r\n"?>
DTSTAMP:<?php echo $vCalStart . "Z\r\n"; ?>
DTSTART:<?php echo $vCalStart . "Z\r\n"; ?>
DTEND:<?php echo $vCalEnd . "Z\r\n"; ?>
SUMMARY:<?php echo "sample summary\r\n"; ?>
DESCRIPTION:<?php echo "sample description will be filled in later\r\n"; ?>
UID:123<?="\r\n"?>
X-MICROSOFT-CDO-IMPORTANCE:1<?="\r\n"?>
PRIORITY:3<?="\r\n"?>
CLASS:PUBLIC<?="\r\n"?>
END:VEVENT<?="\r\n"?>
END:VCALENDAR

Open in new window

sample.txt
ASKER CERTIFIED SOLUTION
Avatar of Ray Paseur
Ray Paseur
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of lghaman123
lghaman123

ASKER

Hi Ray, sorry for the delayed response, I got temporarily moved to a different project.  I tried a very similar variation of this code at one point.  After more testing I actually determined that the error was an error being output by my config file which I had included.  This code is definitely working for me now that I fixed my other situation.  Thanks!