hi
i design a php event calendar

but it showing some error, anyone check it plz..

Parse error: syntax error, unexpected T_ELSE in W:\www\Calendar-php\admin\calAdd.php on line 149

<html>
<head>
<title>Calendar: Add</title>


<META HTTP-EQUIV="refresh" content="1;URL=../calendar.php">
<LINK rel="stylesheet" type="text/css" name="style" href="../calendar.css">
</head>

<body bgcolor="#FFFFFF" text="#000000">



<?php


//returns highest key in the database
function getMaxKey($db) {

$maxKey = 0;

$sortby = "event_key";
$result = $db->getall();

foreach($result as $item){
           $key = $item["event_key"];
           if($key > $maxKey)
              $maxKey = $key;
}

return $maxKey;

}

// Include the FFDB library
include("../ffdb.inc.php");

//open db or create new db
$db = new FFDB();
if (!$db->open("../calendar"))
{
   // Define the database shema.
   // Note that the "last_name" field is our key.
   $schema = array(
      array("event_key", FFDB_INT, "key"),
      array("event_name", FFDB_STRING),
      array("event_description", FFDB_STRING),
      array("event_submitted_by", FFDB_STRING),
      array("event_month", FFDB_STRING),
      array("event_day", FFDB_INT),
      array("event_year", FFDB_INT)
   );

   // Try and create it...
   if (!$db->create("calendar", $schema))
   {
      echo "Error creating database\n";
      return;
   }
}

//if no key file create a new one
if(!file_exists("key.dat"))
{
 $newKey = getMaxKey($db);
 $newFile = fopen("key.dat", "w") Or die("Can't open file");
 fwrite($newFile,$newKey);
 fclose($newFile);

}

//add a record
      //convert forms to record
$fileread = fopen("key.dat", "r")Or die("Can't open file");
$data = (int) fread($fileread, 10);
fclose($fileread);
$data++;
$fileread = fopen("key.dat", "w") Or die("Can't open file");
fwrite($fileread,$data);
fclose($fileread);

//removes escape slashes
   $event = stripslashes($event);
   $description = stripslashes($description);
   $submitted = stripslashes($submitted);

//add html entities
   $event = htmlentities($event,ENT_QUOTES);
   $submitted = htmlentities($submitted,ENT_QUOTES);

   $record["event_key"] = $data;
   $record["event_name"] = $event;
   $record["event_description"] = $description;
   $record["event_submitted_by"] = $submitted;
   $record["event_month"] = $month;
   list($record["event_day"]) = sscanf($day, "%d"); // string -> int
   list($record["event_year"]) = sscanf($year, "%d"); // string -> int

      // Add a _new_ entry
      echo("");
      if (!$db->add($record))
         echo("failed!\n");
      else {



//table to display after adding
  $addedTable ="


      <center><font class=\"back\">Record Added: taking you back</font> </center>
  <table cellpadding=\"0\" cellspacing=\"2\" border=\"0\" bgcolor=\"#000000\" align=\"center\"><tr><td>
  <table cellpadding=\"3\" cellspacing=\"0\" border=\"0\" bgcolor=\"#CC0000\" align=\"center\">
<tr><td><font class=\"addHead\"><a href=\"calendar.php\" class=\"addHead\">Calendar</a></font></TD></tr>
<tr><td>

<table cellpadding=\"3\" cellspacing=\"0\" border=\"0\" bgcolor=\"#CCCCCC\">

<tr>
        <td width=\"150\" align=\"right\" height=\"26\"><font class=\"AddLeft\">Event : </font></td>
        <td width=\"350\" height=\"26\"><font class=\"AddRight\">$event</font></td>
</tr>

<tr bgcolor=\"#E3E3E3\">
    <td width=\"150\" align=\"right\"><font class=\"AddLeft\">Event Description : </font></td>
    <td width=\"350\"><font class=\"AddRight\">$description</font></td>
</tr>

<tr>
        <td width=\"150</h5>\" align=\"right\"><font class=\"AddLeft\">Date : </font></td>
        <td width=\"350\" ><font class=\"AddRight\">$day $month $year</font></td>
</tr>

<tr bgcolor=\"#E3E3E3\">
        <td width=\"150\" align=\"right\"><font class=\"AddLeft\">Submitted By : </font></td>
        <td width=\"350\"><font class=\"AddRight\">$submitted</font></td>
</tr>
</table>
</td><tr>
<tr><td align=\"right\"></td></tr>
</table>
</td></tr></table>

";

  echo $addedTable;
}

else 
{ 
echo ("go back and add event");
?>
</body>
</html>

hi
i design a php event calendar

but it showing some error, anyone check it plz..

Parse error: syntax error, unexpected T_ELSE in W:\www\Calendar-php\admin\calAdd.php on line 149

<html>
<head>
<title>Calendar: Add</title>


<META HTTP-EQUIV="refresh" content="1;URL=../calendar.php">
<LINK rel="stylesheet" type="text/css" name="style" href="../calendar.css">
</head>

<body bgcolor="#FFFFFF" text="#000000">



<?php


//returns highest key in the database
function getMaxKey($db) {

$maxKey = 0;

$sortby = "event_key";
$result = $db->getall();

foreach($result as $item){
           $key = $item["event_key"];
           if($key > $maxKey)
              $maxKey = $key;
}

return $maxKey;

}

// Include the FFDB library
include("../ffdb.inc.php");

//open db or create new db
$db = new FFDB();
if (!$db->open("../calendar"))
{
   // Define the database shema.
   // Note that the "last_name" field is our key.
   $schema = array(
      array("event_key", FFDB_INT, "key"),
      array("event_name", FFDB_STRING),
      array("event_description", FFDB_STRING),
      array("event_submitted_by", FFDB_STRING),
      array("event_month", FFDB_STRING),
      array("event_day", FFDB_INT),
      array("event_year", FFDB_INT)
   );

   // Try and create it...
   if (!$db->create("calendar", $schema))
   {
      echo "Error creating database\n";
      return;
   }
}

//if no key file create a new one
if(!file_exists("key.dat"))
{
 $newKey = getMaxKey($db);
 $newFile = fopen("key.dat", "w") Or die("Can't open file");
 fwrite($newFile,$newKey);
 fclose($newFile);

}

//add a record
      //convert forms to record
$fileread = fopen("key.dat", "r")Or die("Can't open file");
$data = (int) fread($fileread, 10);
fclose($fileread);
$data++;
$fileread = fopen("key.dat", "w") Or die("Can't open file");
fwrite($fileread,$data);
fclose($fileread);

//removes escape slashes
   $event = stripslashes($event);
   $description = stripslashes($description);
   $submitted = stripslashes($submitted);

//add html entities
   $event = htmlentities($event,ENT_QUOTES);
   $submitted = htmlentities($submitted,ENT_QUOTES);

   $record["event_key"] = $data;
   $record["event_name"] = $event;
   $record["event_description"] = $description;
   $record["event_submitted_by"] = $submitted;
   $record["event_month"] = $month;
   list($record["event_day"]) = sscanf($day, "%d"); // string -> int
   list($record["event_year"]) = sscanf($year, "%d"); // string -> int

      // Add a _new_ entry
      echo("");
      if (!$db->add($record))
         echo("failed!\n");
      else {



//table to display after adding
  $addedTable ="


      <center><font class=\"back\">Record Added: taking you back</font> </center>
  <table cellpadding=\"0\" cellspacing=\"2\" border=\"0\" bgcolor=\"#000000\" align=\"center\"><tr><td>
  <table cellpadding=\"3\" cellspacing=\"0\" border=\"0\" bgcolor=\"#CC0000\" align=\"center\">
<tr><td><font class=\"addHead\"><a href=\"calendar.php\" class=\"addHead\">Calendar</a></font></TD></tr>
<tr><td>

<table cellpadding=\"3\" cellspacing=\"0\" border=\"0\" bgcolor=\"#CCCCCC\">

<tr>
        <td width=\"150\" align=\"right\" height=\"26\"><font class=\"AddLeft\">Event : </font></td>
        <td width=\"350\" height=\"26\"><font class=\"AddRight\">$event</font></td>
</tr>

<tr bgcolor=\"#E3E3E3\">
    <td width=\"150\" align=\"right\"><font class=\"AddLeft\">Event Description : </font></td>
    <td width=\"350\"><font class=\"AddRight\">$description</font></td>
</tr>

<tr>
        <td width=\"150</h5>\" align=\"right\"><font class=\"AddLeft\">Date : </font></td>
        <td width=\"350\" ><font class=\"AddRight\">$day $month $year</font></td>
</tr>

<tr bgcolor=\"#E3E3E3\">
        <td width=\"150\" align=\"right\"><font class=\"AddLeft\">Submitted By : </font></td>
        <td width=\"350\"><font class=\"AddRight\">$submitted</font></td>
</tr>
</table>
</td><tr>
<tr><td align=\"right\"></td></tr>
</table>
</td></tr></table>

";

  echo $addedTable;
}

else 
{ 
echo ("go back and add event");
?>
</body>
</html> 

end quote.

Hi rohini..

plz put ur code in CODE tags

ok..
at last line u have to close else part }

Edited 3 Years Ago by mike_2000_17: Fixed formatting

i think you are using two else loops here ..
one is on line : 103
and another one is on line 149.
And you just forget to close your second else loop..
You loop structure is not good...
Concentrate on those...
And use code tags by next time....

Notice: Undefined variable: sent_month in E:\domains\h\highweb.co.uk\user\htdocs\geeta\assignments\php\Calendar-php\calendar.php on line 431

<html>
<head>
<title>Calendar</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<LINK rel="stylesheet" type="text/css" name="style" href="calendar.css">
</head>

<body bgcolor="#FFFFFF" text="#000000">

<table cellpadding="0" cellspacing="2" border="0" align="center" bgcolor="#000000"><tr><td>
<table cellpadding="2" cellspacing="0" border="0" align="center" bgcolor="#CC0000">
<tr><td width="200" valign="middle">&nbsp;&nbsp</td>
    <td width="348" align="center">&nbsp;</td>
    <td width="200" align="right"><A HREF="admin/add.php" class="addEvent">Add Event&nbsp;&nbsp; </a></td>
</tr>
</table>
  </td></tr></table><BR><BR>


<?php
// Include the FFDB library
include("ffdb.inc.php");

//open db or create new db
$db = new FFDB();
if (!$db->open("calendar"))
{
   // Define the database shema.
   // Note that the "last_name" field is our key.
   $schema = array(
      array("event_key", FFDB_INT, "key"),
      array("event_name", FFDB_STRING),
      array("event_description", FFDB_STRING),
      array("event_submitted_by", FFDB_STRING),
      array("event_month", FFDB_STRING),
      array("event_day", FFDB_INT),
      array("event_year", FFDB_INT)
   );
      // Try and create it...
   if (!$db->create("calendar", $schema))
   {
      echo "Error creating database\n";
      return;
   }
}

function today($record)
{          global $event_day;
           global $event_month;
           global $event_year;

         //echo "$event_month $event_day $event_year";
   if (($record["event_month"] == $event_month) &&
           ($record["event_day"] == $event_day) &&
           ($record["event_year"] == $event_year))
          return true;
          return false;
}

function show_event($record){
         $eventNumber = $record["event_key"];
         $eventName = $record["event_name"];
         echo "<font class=\"eventLink\">-<a href=\"viewEvent.php?eventNumber=$eventNumber\" class=\"eventLink\">$eventName</a></font> <br>";
}

function getEvents(){
global $db;
         //get events for today
$result = $db->getbyfunction("today");

//display events if there are any
if($result != null)
foreach($result as $item)
   show_event($item);
}

function days_in_month($_month, $_year)
{

        if($_month == 2)
        {        return days_in_feb($_year);  }

        else {

        if($_month == 1 || $_month == 3 || $_month == 5 || $_month == 7 || $_month == 8 || $_month == 10 || $_month == 12)
             {        return(31);  }
        else {  return(30);  }
        }

}

function selectMonth($_month){

$selectstart = "
<select name=\"sent_month\">  ";
$selectend = "
</select>";

echo $selectstart;

echo "<option value=\"January\"";
       if($_month == 1)
          echo " selected=\"selected\" ";
echo ">January</option>
";

echo "<option value=\"February\"";
       if($_month == 2)
          echo " selected=\"selected\" ";
echo ">February</option>
";

echo "<option value=\"March\"";
       if($_month == 3)
          echo " selected=\"selected\" ";
echo ">March</option>
";

echo "<option value=\"April\"";
       if($_month == 4)
          echo " selected=\"selected\" ";
echo ">April</option>
";

echo "<option value=\"May\"";
       if($_month == 5)
          echo " selected=\"selected\" ";
echo ">May</option>
";

echo "<option value=\"June\"";
       if($_month == 6)
          echo " selected=\"selected\" ";
echo ">June</option>
";

echo "<option value=\"July\"";
       if($_month == 7)
          echo " selected=\"selected\" ";
echo ">July</option>
";

echo "<option value=\"August\"";
       if($_month == 8)
          echo " selected=\"selected\" ";
echo ">August</option>
";

echo "<option value=\"September\"";
       if($_month == 9)
          echo " selected=\"selected\" ";
echo ">September</option>
";

echo "<option value=\"October\"";
       if($_month == 10)
          echo " selected=\"selected\" ";
echo ">October</option>
";

echo "<option value=\"November\"";
       if($_month == 11)
          echo " selected=\"selected\" ";
echo ">November</option>
";

echo "<option value=\"December\"";
       if($_month == 12)
          echo " selected=\"selected\" ";
echo ">December</option>
";


echo $selectend;

}

function selectYear($selectedyear){
      $day = getdate();
      $year = $day['year'];


$selectyeartop = "

<select name=\"sent_year\">
";
$selectyearbottom = "
</select>
";
         echo $selectyeartop;

         for($i=$year; $i<$year+5; $i++) {
             echo "<option value=\"$i\"";
             if($i == $selectedyear)
                echo "selected=\"selected\"";
             echo "> $i</option>
             ";

         }

         echo $selectyearbottom;

}

function convertMonth($alpha_month){
         if($alpha_month == "January")
              return 1;
         else if($alpha_month== "February")
              return 2;
         else if($alpha_month== "February")
              return 2;
         else if($alpha_month== "March")
              return 3;
         else if($alpha_month== "April")
              return 4;
         else if($alpha_month== "May")
              return 5;
         else if($alpha_month== "June")
              return 6;
         else if($alpha_month== "July")
              return 7;
         else if($alpha_month== "August")
              return 8;
         else if($alpha_month== "September")
              return 9;
         else if($alpha_month== "October")
              return 10;
         else if($alpha_month== "November")
              return 11;
         else if($alpha_month== "December")
              return 12;

         return 1;

}


function days_in_feb($year){

        //$year must be YYYY
        //[gregorian] leap year math :

        if ($year < 0) $year++;
        $year += 4800;

    if ( ($year % 4) == 0) {
                if (($year % 100) == 0) {
                    if (($year % 400) == 0) {
                                return(29);
                    } else {
                                return(28);
                    }
                } else {
                    return(29);
                }
    } else {
                return(28);
    }
}


/*
  prints the month and year that are passed to it in
  $date
*/
function printMonth($_month, $_year)
{

$timestamp = mktime(0,0,0,$_month,1,2000);
$date = getdate ($timestamp);
$monthText = $date['month'];


 $monthtext1 =
"
<!-- month heading -------------------------------------------->
<table align=\"center\">
<tr>
<td align=\"left\">
 <form name=\"goto\" action=\"calendar.php\" method=\"POST\">
<table cellpadding=\"2\" cellspacing=\"0\" border=\"0\" bgcolor=\"#000000\" align=\"center\">
<tr><td>
<table cellpadding=\"5\" cellspacing=\"0\" border=\"0\" bgcolor=\"#CC0000\">
<tr><td width=\"200\">";

$monthtext2 = "<input type=\"image\" src=\"go.gif\" name=\"go\" border=\"0\">

</td></tr></table>
</td></tr></table>
</form>
</td>

<td align=\"center\" width=\"355\" valign=\"top\"><font class=\"month\">$monthText $_year</font></td>
<td align=\"right\" width=\"186\" valign=\"top\"></td>
</tr>
</table>
<!-- end of month heading ------------------------------------->

";
 echo "$monthtext1";
 selectMonth($_month);
 selectYear($_year);
 echo "$monthtext2";
}

/*
  prints the bar that contains the days of the week
*/
function printDays()
{
 $daybar =
"
<!-- days of the week heading --------------------------------->
<table align=\"center\" bgcolor=\"#000000\">
<TR>
<td width=\"105\" align=\"center\" bgcolor=\"#CC0000\"><font class=\"daysfont\">Sunday</font></td>
<td width=\"105\" align=\"center\" bgcolor=\"#CC0000\"><font class=\"daysfont\">Monday</font></td>
<td width=\"105\" align=\"center\" bgcolor=\"#CC0000\"><font class=\"daysfont\">Tuesday</font></td>
<td width=\"105\" align=\"center\" bgcolor=\"#CC0000\"><font class=\"daysfont\">Wednesday</font></td>
<td width=\"105\" align=\"center\" bgcolor=\"#CC0000\"><font class=\"daysfont\">Thursday</font></td>
<td width=\"105\" align=\"center\" bgcolor=\"#CC0000\"><font class=\"daysfont\">Friday</font></td>
<td width=\"105\" align=\"center\" bgcolor=\"#CC0000\"><font class=\"daysfont\">Saturday</font></td>
</tr>

<!-- end days of the week heading ----------------------------->

";

  echo $daybar;
}


/*
  opens table for calendar which is closed by last week, then prints the first
  week to the calendar
*/
function printFirstWeek($_day)
{
 global $event_day;
//write table declarations
 echo "

<!-- begin day boxes ------------------------------------------>


<tr>

 ";

 $current_day = 1;

 $spot = 0;

 while ($spot < $_day){

        echo "<td width=\"105\" height=\"115\" valign=\"top\" bgcolor=\"#e3e3e3\">&nbsp</td>
        ";
        $spot++;
 }

 while ($spot < 7){
        $event_day = $current_day;
        echo "<td width=\"105\" height=\"115\" valign=\"top\" bgcolor=\"#CCCCCC\"><font class=\"number\">$current_day</font><br>";
        getEvents();
        echo "</td>
        ";

        $spot++;
        $current_day++;

 }

echo"</tr>
";

return $current_day;
}

function printWeek($_day, $_last)
{
 global $event_day;

 while ($_day <= ($_last - 7)){
    $count = 0;
    echo "<TR>
    ";
    while($count < 7){
          $event_day = $_day;
          echo "<td width=\"105\" height=\"115\" valign=\"top\" bgcolor=\"#CCCCCC\"><font class=\"number\">$_day</font><br>";
          getEvents();
          echo "</td>
          ";
          $_day++;
          $count++;
    }
    echo "</TR>
    ";
 }
    return $_day;

}

function printLastWeek($_day, $_lastday)
{
        global $event_day;
 $count = 0;
      echo "<TR>
    ";
 while($count <= $_lastday)
 {
           $event_day = $_day;
           echo "<td width=\"105\" height=\"115\" valign=\"top\" bgcolor=\"#CCCCCC\"><font class=\"number\">$_day</font><br>";
           getEvents();
           echo "</td>
          ";
          $_day++;
          $count++;
 }

 while($count < 7)
 {
         echo "<td width=\"105\" height=\"115\" valign=\"top\" bgcolor=\"#e3e3e3\">&nbsp;</td>
        ";
        $count++;
        $_day++;
 }

 echo "</tr>
 ";
 echo "</table>
 <!-- end day boxes ------------------------------------------>

 ";
 }



//calculate all date information needed
if($sent_month && $sent_year){
   $month = convertMonth($sent_month);
   $year = $sent_year;
   $event_day = 1;
   $event_month = $sent_month;
   $event_year = $year;
   }
else {
      $day = getdate();
      $month = $month = $day['mon'];
      $mday = $mday = $day['mday'];
      $year = $year = $day['year'];
      $event_day = 1;
      $event_month = $day['month'];
      $event_year = $year;
      }


$days_in_month = days_in_month ($month, $year);

$first_day = mktime(0,0,0,$month,1,$year);
$date_first = getdate ($first_day);

$last_day = mktime(0,0,0,$month,$days_in_month,$year);
$date_last = getdate($last_day);

$dayofweekfirst = $date_first['wday'];
$dayofweeklast = $date_last['wday'];
//end date calculations





printMonth($month, $year);
printDays();
$current = printFirstWeek($dayofweekfirst);
$current = printWeek($current, $days_in_month);
printLastWeek($current, $dayofweeklast);



?>

<table cellpadding="0" cellspacing="0" border="0" align="center"><TR><TD width="750"><A href="viewAll.php" class="viewEvent">View All Events</a></td></tr></table>
<table cellpadding="0" cellspacing="0" border="0" align="center">
<tr>
<td width="600" align="center">&nbsp;</td>
</tr>
</table>
</BODY>
</HTML>

Notice: Undefined variable: event in E:\domains\h\highweb.co.uk\user\htdocs\geeta\assignments\php\Calendar-php\admin\calAdd.php on line 46

Notice: Undefined variable: description in E:\domains\h\highweb.co.uk\user\htdocs\geeta\assignments\php\Calendar-php\admin\calAdd.php on line 47

Notice: Undefined variable: submitted in E:\domains\h\highweb.co.uk\user\htdocs\geeta\assignments\php\Calendar-php\admin\calAdd.php on line 48

Notice: Undefined variable: month in E:\domains\h\highweb.co.uk\user\htdocs\geeta\assignments\php\Calendar-php\admin\calAdd.php on line 55

Notice: Undefined variable: day in E:\domains\h\highweb.co.uk\user\htdocs\geeta\assignments\php\Calendar-php\admin\calAdd.php on line 56

Notice: Undefined variable: year in E:\domains\h\highweb.co.uk\user\htdocs\geeta\assignments\php\Calendar-php\admin\calAdd.php on line 57

Fatal error: Invalid string value field during add: event_month in E:\domains\h\highweb.co.uk\user\htdocs\geeta\assignments\php\Calendar-php\ffdb.inc.php on line 487

Comments
Concentrate on what others say. Please use [code] tags. :icon_mad:
Attachments
calladd.php

<html>
<head>
<title>Calendar: Add</title>
<META HTTP-EQUIV="refresh" content="1;URL=../calendar.php">
<LINK rel="stylesheet" type="text/css" name="style" href="../calendar.css">
</head>
<body bgcolor="#FFFFFF" text="#000000">
<?php

function getMaxKey($db)
{
    $maxKey = 0;
    $sortby = "event_key";
    $result = $db->getall();
    foreach ($result as $item) {
        $key = $item["event_key"];
        if ($key > $maxKey) $maxKey = $key;
    }
    return $maxKey;
}
include ("../ffdb.inc.php");
$db = new FFDB();
if (!$db->open("../cal")) {
    $schema = array(array("event_key", FFDB_INT, "key"), array("event_name",
        FFDB_STRING), array("event_description", FFDB_STRING), array("event_submitted_by",
        FFDB_STRING), array("event_month", FFDB_STRING), array("event_day", FFDB_INT),
        array("event_year", FFDB_INT));
    if (!$db->create("calendar", $schema)) {
        echo "Error creating database\n";
        return;
    }
}
if (!file_exists("key.dat")) {
    $newKey = getMaxKey($db);
    $newFile = fopen("key.dat", "w") or die("Can't open file");
    fwrite($newFile, $newKey);
    fclose($newFile);
}
$fileread = fopen("key.dat", "r") or die("Can't open file");
$data = (int)fread($fileread, 10);
fclose($fileread);
$data++;
$fileread = fopen("key.dat", "w") or die("Can't open file");
fwrite($fileread, $data);
fclose($fileread);
$event = stripslashes($event);
$description = stripslashes($description);
$submitted = stripslashes($submitted);
$event = htmlentities($event, ENT_QUOTES);
$submitted = htmlentities($submitted, ENT_QUOTES);
$record["event_key"] = $data;
$record["event_name"] = $event;
$record["event_description"] = $description;
$record["event_submitted_by"] = $submitted;
$record["event_month"] = $month;
list($record["event_day"]) = sscanf($day, "%d");
list($record["event_year"]) = sscanf($year, "%d");
echo ("");
if ($db->add($record)) {
    $addedTable = "
<center><font class=\"back\">Record Added: taking you back</font> </center>
<table cellpadding=\"0\" cellspacing=\"2\" border=\"0\" bgcolor=\"#000000\" align=\"center\"><tr><td>
<table cellpadding=\"3\" cellspacing=\"0\" border=\"0\" bgcolor=\"#CC0000\" align=\"center\">
<tr><td><font class=\"addHead\"><a href=\"cal.php\" class=\"addHead\">Calendar</a></font></TD></tr>
<tr><td>
<table cellpadding=\"3\" cellspacing=\"0\" border=\"0\" bgcolor=\"#CCCCCC\">
<tr>
<td width=\"150\" align=\"right\" height=\"26\"><font class=\"AddLeft\">Event : </font></td>
<td width=\"350\" height=\"26\"><font class=\"AddRight\">$event</font></td>
</tr>
<tr bgcolor=\"#E3E3E3\">
<td width=\"150\" align=\"right\"><font class=\"AddLeft\">Event Description : </font></td>
<td width=\"350\"><font class=\"AddRight\">$description</font></td>
</tr>
<tr>
<td width=\"150</h5>\" align=\"right\"><font class=\"AddLeft\">Date : </font></td>
<td width=\"350\" ><font class=\"AddRight\">$day $month $year</font></td>
</tr>
<tr bgcolor=\"#E3E3E3\">
<td width=\"150\" align=\"right\"><font class=\"AddLeft\">Submitted By : </font></td>
<td width=\"350\"><font class=\"AddRight\">$submitted</font></td>
</tr>
</table>
</td><tr>
<tr><td align=\"right\"></td></tr>
</table>
</td></tr></table>
";
    echo $addedTable;
}
else {
    echo ("go back and add event");
}
?>
</body>
</html>


ffdb.inc.php
<?php



define("FFDB_VERSION_MAJOR", 2);


/*!
 * @defined FFDB_VERSION_MINOR
 * @discussion Minor version of the FFDB package
 */
define("FFDB_VERSION_MINOR", 7);


/*!
 * @defined FFDB_VERSION
 * @discussion Version of the FFDB package
 */
define("FFDB_VERSION", FFDB_VERSION_MAJOR.".".FFDB_VERSION_MINOR);

/*!
 * @defined FFDB_INT
 * @discussion Flat File DataBase int type
 */
define("FFDB_INT", 0);

/*!
 * @defined FFDB_INT_AUTOINC
 * @discussion Flat File DataBase automatically incremented int type
 */
define("FFDB_INT_AUTOINC", 5);

/*!
 * @defined FFDB_STRING
 * @discussion Flat File DataBase string type
 */
define("FFDB_STRING", 1);

/*!
 * @defined FFDB_ARRAY
 * @discussion Flat File DataBase array type
 */
define("FFDB_ARRAY", 2);

/*!
 * @defined FFDB_FLOAT
 * @discussion Flat File DataBase float type
 */
define("FFDB_FLOAT", 3);

/*!
 * @defined FFDB_BOOL
 * @discussion Flat File DataBase boolean type
 */
define("FFDB_BOOL", 4);


/*!
 * @defined FFDB_IFIELD
 * @discussion Index field used when returning records.  See the 
 * getbyfield(...), getbyfunction(...) and getall(...) methods.
 */
define("FFDB_IFIELD", "FFDB_IFIELD");


/*!
 * @defined FFDB_SIGNATURE
 * @discussion Database signature placed at the start of each index file.
 * Internal use only.
 */
define("FFDB_SIGNATURE", 0x42444646 /* "FFDB" in hex */);


/*!
 * @defined FFDB_INDEX_VERSION_OFFSET
 * @discussion Location of the 'version' offset in the FFDB index.
 * Internal use only.
 */
define("FFDB_INDEX_VERSION_OFFSET", 4);


/*!
 * @defined FFDB_INDEX_RECORDS_OFFSET
 * @discussion Location of the 'records count' offset in the FFDB index.
 * Internal use only.
 */
define("FFDB_INDEX_RECORDS_OFFSET", 6);


/*!
 * @defined FFDB_INDEX_DELETED_OFFSET
 * @discussion Location of the 'deleted count' offset in the FFDB index.
 * Always the next 'int size' offset after the 'records count' offset.
 * Internal use only.
 */
define("FFDB_INDEX_DELETED_OFFSET", FFDB_INDEX_RECORDS_OFFSET+4);


/*!
 * @defined FFDB_INDEX_RBLOCK_SIZE
 * @discussion Size of the field specifing the size of a record in the index.
 * Internal use only.
 */
define("FFDB_INDEX_RBLOCK_SIZE", 4 /* int */);


/*! 
 * @class FFDB
 * @abstract Flat File DataBase Class
 * @discussion Implements a flat file database.
 */
class FFDB
{
   var $DBHost = "mysql11.streamline.net";
var $DBPort = "3306";
var $DBUser = "highwebco";
var $DBDatabase = "highwebco";
var $DBPassword = "s106251";

  var $Persistent = false;
   var $fields;
   var $autoinc;
   var $primary_key;
   var $index_start;

   
   /*!
    * @function FFDB
    * @abstract Constructor
    */
   function FFDB()
   {
      // Disable auto-clean by default
      $this->auto_clean = -1;

      // Database hasn't been opened yet...
      $this->isopen = false;

      // Ignore user aborts that might corrupt the database
      ignore_user_abort(true);
   }

   
   /*!
    * @function open
    * @abstract Opens the given database
    * @param dbname  string - The name of the database to open
    * @result bool - true if successful, false if failed
    */
   function open($dbname)
   {
      // Close existing databases first
      if ($this->isopen)
         $this->close();
      
      // Open the database files
      $this->data_fp = @fopen($dbname.".dat", "rb+");
      if ($this->data_fp === false)
      {
         // user_error("Cannot open data file: $dbname.dat", E_USER_ERROR);
         return false;
      }

      $this->meta_fp = @fopen($dbname.".met", "rb+");
      if (!$this->meta_fp)
      {
         fclose($this->data_fp);
         // user_error("Cannot open meta file: $dbname.met", E_USER_ERROR);
         return false;
      }

      $this->forcelock = 0;
      $this->locked = 0;
      $this->isopen = true;
      $this->dbname = $dbname;
      
      if (!$this->lock_read())
         return false;

      // Read and verify the signature
      $sig = $this->read_int($this->meta_fp);
      if ($sig != FFDB_SIGNATURE)
      {
         $this->unlock();
         user_error("Invalid database: $dbname.", E_USER_ERROR);
         return false;
      }

      // Read the version
      $ver_major = $this->read_byte($this->meta_fp);
      $ver_minor = $this->read_byte($this->meta_fp);

      // Make sure we only read databases of the same major version,
      // with minor version less or equal to the current.
      if ($ver_major != FFDB_VERSION_MAJOR)
      {
         $this->unlock();
         user_error(
            "Cannot open database (of version $ver_major.$ver_minor), "
           ."wrong version.", 
            E_USER_ERROR
         );
         return false;
      }
      if ($ver_minor > FFDB_VERSION_MINOR)
      {
         $this->unlock();
         user_error(
            "Cannot open database (of version $ver_major.$ver_minor), "
           ."wrong version.", 
            E_USER_ERROR
         );
         return false;
      }

      // Read the schema and database statistics from the meta file.
      $this->read_schema();

      $this->unlock();

      return true;
   }

   
   /*!
    * @function close
    * @abstract Closes the currently opened database
    */
   function close()
   {
      if ($this->isopen)
      {
         @fclose($this->data_fp);
         @fclose($this->meta_fp);
         $this->isopen = false;
      }
   }


   /*!
    * @function drop
    * @abstract Closes the current database then deletes it.
    * @result bool - true on success
    */
   function drop()
   {
      if (!$this->isopen)
      {
         user_error("Database not open.", E_USER_ERROR);
         return false;
      }

      $this->close();
      @unlink($this->dbname.".dat");
      @unlink($this->dbname.".met");

      return true;
   }


   /*!
    * @function create
    * @abstract Creates a new database
    * @param dbname  string - name of the database
    * @param schema  array - name<->type array of fields for table.
    * Note that the key cannot be an array or boolean type field.  
    * The key is given by a third attribute - a string "key".
    * @result bool - true if successful, false on failure
    */
   function create($dbname, $schema)
   {
      // Close any existing DB first
      if ($this->isopen)
         $this->close();

      // Find the primary key and do error checking on the schema
      $this->fields = array();
      $this->autoinc = array();
      $this->primary_key = "";

      for($i=0; $i<count($schema); ++$i)
      {
         $field = $schema[$i];

         if (!is_array($field))
            return false;

         $name =

you are not initialised or used these variables $sent_month and $sent_year before...what data you want to put in that variable...
refine your code and write coding accordingly....

use code tags....

hii
i m designing a php event based calendar
this is my code, can anyone tell me its script code,mine is not working..

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Untitled Document</title>
<link href="style/style.css" rel="stylesheet" type="text/css" />
</head>

<body>
<?php
// Get values from query string 
$day = $_GET["day"]; 
$month = $_GET["month"]; 
$year = $_GET["year"]; 
$sel = $_GET["sel"]; 
$what = $_GET["what"]; 

if($day == "") 
$day = date("j"); 

if($month == "") 
$month = date("m"); 

if($year == "") 
$year = date("Y"); 
$currentTimeStamp = strtotime("$year-$month-$day"); 
$monthName = date("F", $currentTimeStamp); 
$numDays = date("t", $currentTimeStamp); 
$counter = 0; 
$numEventsThisMonth = 0; 
$hasEvent = false; 
$todaysEvents = ""; 

<table width='350' border='0' cellspacing='0' cellpadding='0'> 
<tr> 
<td class='head' width='50'>S</td> 
<td class='head' width='50'>M</td> 
<td class='head' width='50'>T</td> 
<td class='head' width='50'>W</td> 
<td class='head' width='50'>T</td> 
<td class='head' width='50'>F</td> 
<td class='head' width='50'>S</td> 
</tr> 

$numDays = date("t", $currentTimeStamp); 
for($i = 1; $i < $numDays+1; $i++, $counter++) 
{ 
$timeStamp = strtotime("$year-$month-$i"); 

if($i == 1) 
{ 
// Workout when the first day of the month is 
$firstDay = date("w", $timeStamp); 

for($j = 0; $j < $firstDay; $j++, $counter++) 
echo "<td>&nbsp;</td>"; 
} 

if($counter % 7 == 0) 
echo "</tr><tr>"; 

echo "<td width='50'>$I</td>"; 

if(date("w", $timeStamp) == 0 || date("w", $timeStamp) == 6) 
echo "class='weekend'"; 
else 
if($i == date("d") && $month == date("m") && $year == date("Y")) 
echo "class='today'"; 
else 
echo "class='normal'"; 
$monthName = date("F", $currentTimeStamp); 

<tr> 
<td width='50' colspan='1'> 
<input type='button' value=' < ' onClick='goLastMonth(<?php echo $month . ", " . $year; ?>)'> 
</td> 
<td width='250' colspan='5'> 
<span class='title'><?php echo $monthName . " " . $year; ?></span><br> 
</td> 
<td width='50' colspan='1' align='right'> 
<input type='button' value=' > ' onClick='goNextMonth(<?php echo $month . ", " . $year; ?>)'> 
</td> 
</tr> 

<script>
function goLastMonth(month, year) 
{ 
// If the month is Januaru, decrement the year 
if(month == 1) 
{ 
--year; 
month = 13; 
} 

document.location.href = 'cal.php?month='+(month-1)+'&year='+year; 
} 
cal.php?month=12&year=2002 
function goNextMonth(month, year) 
{ 
// If the month is December, increment the year 
if(month == 12) 
{ 
++year; 
month = 0; 
} 

document.location.href = 'cal.php?month='+(month+1)+'&year='+year; 
} 


</script>
<?php
function ReadEvents($Month) 
function ReadEvents($Month) 
{ 

$theEvents = array(); 
$eventCounter = 0; 

// Make sure that the file exists 
if(!file_exists($_SERVER["DOCUMENT_ROOT"] . "/" . EVENT_FILE)) 
{ 
$fp = @fopen($_SERVER["DOCUMENT_ROOT"] . "/" . EVENT_FILE, "w") 
or die("<span class='error'>ERROR: Couldn't create events file.</span>"); 
@fclose($fp); 
} 
$fp = @fopen($_SERVER["DOCUMENT_ROOT"] . "/" . EVENT_FILE, "rb") 
or die("<span class='error'>ERROR: Couldn't open events file to read events.</span>"); 
define("EVENT_FILE", "cal_events.text"); 
while($data = fread($fp, 1024)) 
{ 
$events .= $data; 
} 

@fclose($fp); 
// Seperate the data into line-seperated arrays 
$arrEvents = explode("\r\n", $events); 
// Loop through the results and pick the arrays 
// that match the selected month 
for($i = 0; $i < sizeof($arrEvents); $i+=3) 
{ 
// Get each part of the events date as an index 
// of an array 
$arrEventDate = explode(" ", $arrEvents[$i]); 

// If the month is the selected month the grab 
// the details of this event 
if((int)$arrEventDate[0] == (int)$Month) 
{ 
$theEvents[$eventCounter++] = array("day" => $arrEventDate[1], "name" => $arrEvents[$i+1], "desc" => $arrEvents[$i+2]); 
} 
} 



return $theEvents; 
foreach($arrEvents as $eventEntry) 
{ 
if($eventEntry["day"] == $i) 
{ 
// We have at least one event for the day 
$hasEvent = true; 
$numEventsThisMonth++; 
… 
} 
} 
} 

// Is it a weekend, does it have events, etc 
if($i == $day && $month == date("m") && $year == date("Y") && $sel == 1) 
echo "class='selected'"; 
else if($i == $day && $sel == 1) 
echo "class='selected'"; 
else if($hasEvent == true) 
echo "class='event'"; 
else 
if(date("w", $timeStamp) == 0 || date("w", $timeStamp) == 6) 
echo "class='weekend'"; 
else 
if($i == date("d") && $month == date("m") && $year == date("Y")) 
echo "class='today'"; 
else 
echo "class='normal'"; 

$arrEvents = ReadEvents($month); 

... 

foreach($arrEvents as $eventEntry) 
{ 
if($eventEntry["day"] == $i) 
{ 
// We have at least one event for the day 
$hasEvent = true; 
$numEventsThisMonth++; 

if($eventEntry["day"] == $day) 
{ 
// Add the event to the $todaysEvents variable 
$todaysEvents .= "<span class='eventTitle'>" . stripslashes($eventEntry["name"]) . "</span>"; 

$todaysEvents .= "<span class='eventDesc'><br>" . stripslashes($eventEntry["desc"]) . "</span><br>"; 

$todaysEvents .= " <a href='cal.php?sel=1&what=delPost&day=$day&month=$month&year=$year&eName=" . urlencode($eventEntry["name"]) . "&eDesc=" . urlencode($eventEntry["desc"]) . "'>[Remove]</a><br><br>"; 
} 
} 
} 



if($sel == 1) 
{ 
echo "<tr>"; 
echo " <td width='350' colspan='7'>"; 
echo " <hr size='1' color='#CACACA' noshade>"; 
echo " <span class='Title'>Today's Events</span><br><br>"; 
echo $todaysEvents; 
echo " </td>"; 
echo "</tr>"; 
} 


?>

</body>
</html>

Parse error: syntax error, unexpected '<' in W:\www\ccc\cal.php on line 34

hii
i m designing a php event based calendar
this is my code, can anyone tell me its script code,mine is not working..

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Untitled Document</title>
<link href="style/style.css" rel="stylesheet" type="text/css" />
</head>

<body>
<?php
// Get values from query string
$day = $_GET["day"];
$month = $_GET["month"];
$year = $_GET["year"];
$sel = $_GET["sel"];
$what = $_GET["what"];

if($day == "")
$day = date("j");

if($month == "")
$month = date("m");

if($year == "")
$year = date("Y");
$currentTimeStamp = strtotime("$year-$month-$day");
$monthName = date("F", $currentTimeStamp);
$numDays = date("t", $currentTimeStamp);
$counter = 0;
$numEventsThisMonth = 0;
$hasEvent = false;
$todaysEvents = "";

<table width='350' border='0' cellspacing='0' cellpadding='0'>
<tr>
<td class='head' width='50'>S</td>
<td class='head' width='50'>M</td>
<td class='head' width='50'>T</td>
<td class='head' width='50'>W</td>
<td class='head' width='50'>T</td>
<td class='head' width='50'>F</td>
<td class='head' width='50'>S</td>
</tr>

$numDays = date("t", $currentTimeStamp);
for($i = 1; $i < $numDays+1; $i++, $counter++)
{
$timeStamp = strtotime("$year-$month-$i");

if($i == 1)
{
// Workout when the first day of the month is
$firstDay = date("w", $timeStamp);

for($j = 0; $j < $firstDay; $j++, $counter++)
echo "<td>&nbsp;</td>";
}

if($counter % 7 == 0)
echo "</tr><tr>";

echo "<td width='50'>$I</td>";

if(date("w", $timeStamp) == 0 || date("w", $timeStamp) == 6)
echo "class='weekend'";
else
if($i == date("d") && $month == date("m") && $year == date("Y"))
echo "class='today'";
else
echo "class='normal'";
$monthName = date("F", $currentTimeStamp);

<tr>
<td width='50' colspan='1'>
<input type='button' value=' < ' onClick='goLastMonth(<?php echo $month . ", " . $year; ?>)'>
</td>
<td width='250' colspan='5'>
<span class='title'><?php echo $monthName . " " . $year; ?></span><br>
</td>
<td width='50' colspan='1' align='right'>
<input type='button' value=' > ' onClick='goNextMonth(<?php echo $month . ", " . $year; ?>)'>
</td>
</tr>

<script>
function goLastMonth(month, year)
{
// If the month is Januaru, decrement the year
if(month == 1)
{
--year;
month = 13;
}

document.location.href = 'cal.php?month='+(month-1)+'&year='+year;
}
cal.php?month=12&year=2002
function goNextMonth(month, year)
{
// If the month is December, increment the year
if(month == 12)
{
++year;
month = 0;
}

document.location.href = 'cal.php?month='+(month+1)+'&year='+year;
}


</script>
<?php
function ReadEvents($Month)
function ReadEvents($Month)
{

$theEvents = array();
$eventCounter = 0;

// Make sure that the file exists
if(!file_exists($_SERVER["DOCUMENT_ROOT"] . "/" . EVENT_FILE))
{
$fp = @fopen($_SERVER["DOCUMENT_ROOT"] . "/" . EVENT_FILE, "w")
or die("<span class='error'>ERROR: Couldn't create events file.</span>");
@fclose($fp);
}
$fp = @fopen($_SERVER["DOCUMENT_ROOT"] . "/" . EVENT_FILE, "rb")
or die("<span class='error'>ERROR: Couldn't open events file to read events.</span>");
define("EVENT_FILE", "cal_events.text");
while($data = fread($fp, 1024))
{
$events .= $data;
}

@fclose($fp);
// Seperate the data into line-seperated arrays
$arrEvents = explode("\r\n", $events);
// Loop through the results and pick the arrays
// that match the selected month
for($i = 0; $i < sizeof($arrEvents); $i+=3)
{
// Get each part of the events date as an index
// of an array
$arrEventDate = explode(" ", $arrEvents[$i]);

// If the month is the selected month the grab
// the details of this event
if((int)$arrEventDate[0] == (int)$Month)
{
$theEvents[$eventCounter++] = array("day" => $arrEventDate[1], "name" => $arrEvents[$i+1], "desc" => $arrEvents[$i+2]);
}
}

return $theEvents;
foreach($arrEvents as $eventEntry)
{
if($eventEntry["day"] == $i)
{
// We have at least one event for the day
$hasEvent = true;
$numEventsThisMonth++;

}
}
}

// Is it a weekend, does it have events, etc
if($i == $day && $month == date("m") && $year == date("Y") && $sel == 1)
echo "class='selected'";
else if($i == $day && $sel == 1)
echo "class='selected'";
else if($hasEvent == true)
echo "class='event'";
else
if(date("w", $timeStamp) == 0 || date("w", $timeStamp) == 6)
echo "class='weekend'";
else
if($i == date("d") && $month == date("m") && $year == date("Y"))
echo "class='today'";
else
echo "class='normal'";

$arrEvents = ReadEvents($month);

...

foreach($arrEvents as $eventEntry)
{
if($eventEntry["day"] == $i)
{
// We have at least one event for the day
$hasEvent = true;
$numEventsThisMonth++;

if($eventEntry["day"] == $day)
{
// Add the event to the $todaysEvents variable
$todaysEvents .= "<span class='eventTitle'>" . stripslashes($eventEntry["name"]) . "</span>";

$todaysEvents .= "<span class='eventDesc'><br>" . stripslashes($eventEntry["desc"]) . "</span><br>";

$todaysEvents .= " <a href='cal.php?sel=1&what=delPost&day=$day&month=$month&year=$year&eName=" . urlencode($eventEntry["name"]) . "&eDesc=" . urlencode($eventEntry["desc"]) . "'>[Remove]</a><br><br>";
}
}
}

if($sel == 1)
{
echo "<tr>";
echo " <td width='350' colspan='7'>";
echo " <hr size='1' color='#CACACA' noshade>";
echo " <span class='Title'>Today's Events</span><br><br>";
echo $todaysEvents;
echo " </td>";
echo "</tr>";
}


?>

</body>
</html>

Parse error: syntax error, unexpected '<' in W:\www\ccc\cal.php on line 34

You just don't learn your lessons ? Do you ? Or are you in 2nd grade ?

<html>
<head>
<title>Calendar: Add</title>
<META HTTP-EQUIV="refresh" content="1;URL=../../calendar.php">
<LINK rel="stylesheet" type="text/css" name="style" href="../../calendar.css">
</head>
<body bgcolor="#FFFFFF" text="#000000">
<?php

function getMaxKey($db)
{
    $maxKey = 0;
    $sortby = "event_key";
    $result = $db->getall();
    foreach ($result as $item) {
        $key = $item["event_key"];
        if ($key > $maxKey) $maxKey = $key;
    }
    return $maxKey;
}
include ("../../ffdb.inc.php");
$db = new FFDB();
if (!$db->open("../calendar")) {
    $schema = array(array("event_key", FFDB_INT, "key"), array("event_name",
        FFDB_STRING), array("event_description", FFDB_STRING), array("event_submitted_by",
        FFDB_STRING), array("event_month", FFDB_STRING), array("event_day", FFDB_INT),
        array("event_year", FFDB_INT));
    if (!$db->create("calendar", $schema)) {
        echo "Error creating database\n";
        return;
    }
}
if (!file_exists("key.dat")) {
    $newKey = getMaxKey($db);
    $newFile = fopen("key.dat", "w") or die("Can't open file");
    fwrite($newFile, $newKey);
    fclose($newFile);
}
else {
	$fileread = fopen("key.dat", "r") or die("Can't open file");
	$data = (int)fread($fileread, 10);
	fclose($fileread);
	$data++;
	$fileread = fopen("key.dat", "w") or die("Can't open file");
	fwrite($fileread, $data);
	fclose($fileread);
}
$event = stripslashes($event);
$description = stripslashes($description);
$submitted = stripslashes($submitted);
$event = htmlentities($event, ENT_QUOTES);
$submitted = htmlentities($submitted, ENT_QUOTES);
$record["event_key"] = $data;
$record["event_name"] = $event;
$record["event_description"] = $description;
$record["event_submitted_by"] = $submitted;
$record["event_month"] = $month;
list($record["event_day"]) = sscanf($day, "%d");
list($record["event_year"]) = sscanf($year, "%d");
echo ("");
{
    echo $addedTable;

else 
{
    echo ("go back and add event");
}
}
?>
</body>
</html>

Parse error: syntax error, unexpected T_ELSE in E:\domains\h\highweb.co.uk\user\htdocs\geeta\assignments\php\calendar\admin\calAdd.php on line 64

<html>
<head>
<title>Calendar: Add</title>
<META HTTP-EQUIV="refresh" content="1;URL=../../calendar.php">
<LINK rel="stylesheet" type="text/css" name="style" href="../../calendar.css">
</head>
<body bgcolor="#FFFFFF" text="#000000">
<?php

function getMaxKey($db)
{
    $maxKey = 0;
    $sortby = "event_key";
    $result = $db->getall();
    foreach ($result as $item) {
        $key = $item["event_key"];
        if ($key > $maxKey) $maxKey = $key;
    }
    return $maxKey;
}
include ("../../ffdb.inc.php");
$db = new FFDB();
if (!$db->open("../calendar")) {
    $schema = array(array("event_key", FFDB_INT, "key"), array("event_name",
        FFDB_STRING), array("event_description", FFDB_STRING), array("event_submitted_by",
        FFDB_STRING), array("event_month", FFDB_STRING), array("event_day", FFDB_INT),
        array("event_year", FFDB_INT));
    if (!$db->create("calendar", $schema)) {
        echo "Error creating database\n";
        return;
    }
}
if (!file_exists("key.dat")) {
    $newKey = getMaxKey($db);
    $newFile = fopen("key.dat", "w") or die("Can't open file");
    fwrite($newFile, $newKey);
    fclose($newFile);
}
else {
	$fileread = fopen("key.dat", "r") or die("Can't open file");
	$data = (int)fread($fileread, 10);
	fclose($fileread);
	$data++;
	$fileread = fopen("key.dat", "w") or die("Can't open file");
	fwrite($fileread, $data);
	fclose($fileread);
}
$event = stripslashes($event);
$description = stripslashes($description);
$submitted = stripslashes($submitted);
$event = htmlentities($event, ENT_QUOTES);
$submitted = htmlentities($submitted, ENT_QUOTES);
$record["event_key"] = $data;
$record["event_name"] = $event;
$record["event_description"] = $description;
$record["event_submitted_by"] = $submitted;
$record["event_month"] = $month;
list($record["event_day"]) = sscanf($day, "%d");
list($record["event_year"]) = sscanf($year, "%d");
echo ("");
{
    echo $addedTable;

else 
{
    echo ("go back and add event");
}
}
?>
</body>
</html>

Parse error: syntax error, unexpected T_ELSE in E:\domains\h\highweb.co.uk\user\htdocs\geeta\assignments\php\calendar\admin\calAdd.php on line 64

Hi....
The below code having one wrong if condition....u need to open on if conition ....u can not open { for echo....

[B]echo ("");
{[/B]
    echo $addedTable;

else 
{
    echo ("go back and add event");
}

how to use code tags?

As you been already instructed in PM's that you so blatantly ignored

[code] YOUR CODE HERE [/code]
OR
[code=php]YOUR CODE HERE [/code]
where php can be replaced by name of any programming language as necessary.

This article has been dead for over six months. Start a new discussion instead.