| | |
php-calendar
Please support our PHP advertiser: PostgreSQL or MySQL? Compare and contrast the two most popular open source databases
![]() |
•
•
Join Date: Feb 2009
Posts: 58
Reputation:
Solved Threads: 0
php Syntax (Toggle Plain Text)
<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
Last edited by peter_budo; Mar 6th, 2009 at 10:51 am. Reason: Keep It Organized - For easy readability, always wrap programming code within posts in [code] (code blocks) and [icode] (inline code) tags.
•
•
Join Date: Feb 2009
Posts: 83
Reputation:
Solved Threads: 7
•
•
•
•
php Syntax (Toggle Plain Text)
<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....
echo ("");
{
echo $addedTable;
else
{
echo ("go back and add event");
} Learn to see in another's calamity the ills which you should avoid.
Publilius Syrus
(~100 BC)
LJC - London Java Community, Graduate & Undergraduate Software Development Community, JAVAWUG (Java Web User Group), The London Android Group
Publilius Syrus
(~100 BC)
LJC - London Java Community, Graduate & Undergraduate Software Development Community, JAVAWUG (Java Web User Group), The London Android Group
![]() |
Similar Threads
- Display Events in Calendar (HTML and CSS)
- free PHP script to add calendar (PHP)
- PHP calendar help please :) (PHP)
- calendar!!! (PHP)
- Anyone work with a wicked cool PHP Calendar before (PHP)
- Zend PHP Certification (PHP)
- IE is hijacked by http://th.msie.cc/index.php?aid=20035 (Viruses, Spyware and other Nasties)
Other Threads in the PHP Forum
- Previous Thread: Hello, someone please HELP me
- Next Thread: xpath Invalid expression
| Thread Tools | Search this Thread |
Tag cloud for PHP
.htaccess access ajax apache api array beginner binary body broken cakephp checkbox class cms code cron curl database date date/time directory display download dynamic echo email error file files folder form forms function functions google href htaccess html image include insert integration ip java javascript joomla limit link list login loop mail menu mlm mod_rewrite msqli_multi_query multiple mycodeisbad mysql oop parse paypal pdf php problem query radio random recursion regex remote script search send seo server sessions sms soap source space sql static structure syntax system table tutorial update upload url validation validator variable video web webdesign wordpress xml youtube





Nevermind! To decipher that 'string', you should atleast be in 3rd grade. 
