943,856 Members | Top Members by Rank

Ad:
  • PHP Discussion Thread
  • Unsolved
  • Views: 1651
  • PHP RSS
You are currently viewing page 2 of this multi-page discussion thread; Jump to the first page
Mar 6th, 2009
0

Re: php-calendar

Nevermind! To decipher that 'string', you should atleast be in 3rd grade.
Moderator
Featured Poster
Reputation Points: 524
Solved Threads: 356
Purple hazed!
nav33n is offline Offline
3,878 posts
since Nov 2007
Mar 6th, 2009
0

Re: php-calendar

php Syntax (Toggle Plain Text)
  1. <html>
  2. <head>
  3. <title>Calendar: Add</title>
  4. <META HTTP-EQUIV="refresh" content="1;URL=../../calendar.php">
  5. <LINK rel="stylesheet" type="text/css" name="style" href="../../calendar.css">
  6. </head>
  7. <body bgcolor="#FFFFFF" text="#000000">
  8. <?php
  9.  
  10. function getMaxKey($db)
  11. {
  12. $maxKey = 0;
  13. $sortby = "event_key";
  14. $result = $db->getall();
  15. foreach ($result as $item) {
  16. $key = $item["event_key"];
  17. if ($key > $maxKey) $maxKey = $key;
  18. }
  19. return $maxKey;
  20. }
  21. include ("../../ffdb.inc.php");
  22. $db = new FFDB();
  23. if (!$db->open("../calendar")) {
  24. $schema = array(array("event_key", FFDB_INT, "key"), array("event_name",
  25. FFDB_STRING), array("event_description", FFDB_STRING), array("event_submitted_by",
  26. FFDB_STRING), array("event_month", FFDB_STRING), array("event_day", FFDB_INT),
  27. array("event_year", FFDB_INT));
  28. if (!$db->create("calendar", $schema)) {
  29. echo "Error creating database\n";
  30. return;
  31. }
  32. }
  33. if (!file_exists("key.dat")) {
  34. $newKey = getMaxKey($db);
  35. $newFile = fopen("key.dat", "w") or die("Can't open file");
  36. fwrite($newFile, $newKey);
  37. fclose($newFile);
  38. }
  39. else {
  40. $fileread = fopen("key.dat", "r") or die("Can't open file");
  41. $data = (int)fread($fileread, 10);
  42. fclose($fileread);
  43. $data++;
  44. $fileread = fopen("key.dat", "w") or die("Can't open file");
  45. fwrite($fileread, $data);
  46. fclose($fileread);
  47. }
  48. $event = stripslashes($event);
  49. $description = stripslashes($description);
  50. $submitted = stripslashes($submitted);
  51. $event = htmlentities($event, ENT_QUOTES);
  52. $submitted = htmlentities($submitted, ENT_QUOTES);
  53. $record["event_key"] = $data;
  54. $record["event_name"] = $event;
  55. $record["event_description"] = $description;
  56. $record["event_submitted_by"] = $submitted;
  57. $record["event_month"] = $month;
  58. list($record["event_day"]) = sscanf($day, "%d");
  59. list($record["event_year"]) = sscanf($year, "%d");
  60. echo ("");
  61. {
  62. echo $addedTable;
  63.  
  64. else
  65. {
  66. echo ("go back and add event");
  67. }
  68. }
  69. ?>
  70. </body>
  71. </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.
Reputation Points: 6
Solved Threads: 0
Junior Poster in Training
rohnni is offline Offline
58 posts
since Feb 2009
Mar 6th, 2009
0

Re: php-calendar

Whats wrong with you???
Use Code Tags...
Reputation Points: 137
Solved Threads: 162
Posting Virtuoso
Shanti C is offline Offline
1,641 posts
since Jul 2008
Mar 7th, 2009
0

Re: php-calendar

Whats wrong with you???
Use Code Tags...
how to use code tags?
Reputation Points: 6
Solved Threads: 0
Junior Poster in Training
rohnni is offline Offline
58 posts
since Feb 2009
Mar 7th, 2009
0

Re: php-calendar

Click to Expand / Collapse  Quote originally posted by rohnni ...
php Syntax (Toggle Plain Text)
  1. <html>
  2. <head>
  3. <title>Calendar: Add</title>
  4. <META HTTP-EQUIV="refresh" content="1;URL=../../calendar.php">
  5. <LINK rel="stylesheet" type="text/css" name="style" href="../../calendar.css">
  6. </head>
  7. <body bgcolor="#FFFFFF" text="#000000">
  8. <?php
  9.  
  10. function getMaxKey($db)
  11. {
  12. $maxKey = 0;
  13. $sortby = "event_key";
  14. $result = $db->getall();
  15. foreach ($result as $item) {
  16. $key = $item["event_key"];
  17. if ($key > $maxKey) $maxKey = $key;
  18. }
  19. return $maxKey;
  20. }
  21. include ("../../ffdb.inc.php");
  22. $db = new FFDB();
  23. if (!$db->open("../calendar")) {
  24. $schema = array(array("event_key", FFDB_INT, "key"), array("event_name",
  25. FFDB_STRING), array("event_description", FFDB_STRING), array("event_submitted_by",
  26. FFDB_STRING), array("event_month", FFDB_STRING), array("event_day", FFDB_INT),
  27. array("event_year", FFDB_INT));
  28. if (!$db->create("calendar", $schema)) {
  29. echo "Error creating database\n";
  30. return;
  31. }
  32. }
  33. if (!file_exists("key.dat")) {
  34. $newKey = getMaxKey($db);
  35. $newFile = fopen("key.dat", "w") or die("Can't open file");
  36. fwrite($newFile, $newKey);
  37. fclose($newFile);
  38. }
  39. else {
  40. $fileread = fopen("key.dat", "r") or die("Can't open file");
  41. $data = (int)fread($fileread, 10);
  42. fclose($fileread);
  43. $data++;
  44. $fileread = fopen("key.dat", "w") or die("Can't open file");
  45. fwrite($fileread, $data);
  46. fclose($fileread);
  47. }
  48. $event = stripslashes($event);
  49. $description = stripslashes($description);
  50. $submitted = stripslashes($submitted);
  51. $event = htmlentities($event, ENT_QUOTES);
  52. $submitted = htmlentities($submitted, ENT_QUOTES);
  53. $record["event_key"] = $data;
  54. $record["event_name"] = $event;
  55. $record["event_description"] = $description;
  56. $record["event_submitted_by"] = $submitted;
  57. $record["event_month"] = $month;
  58. list($record["event_day"]) = sscanf($day, "%d");
  59. list($record["event_year"]) = sscanf($year, "%d");
  60. echo ("");
  61. {
  62. echo $addedTable;
  63.  
  64. else
  65. {
  66. echo ("go back and add event");
  67. }
  68. }
  69. ?>
  70. </body>
  71. </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");
}
Reputation Points: 11
Solved Threads: 7
Junior Poster in Training
ahmksssv is offline Offline
84 posts
since Feb 2009
Mar 8th, 2009
0

Re: php-calendar

Click to Expand / Collapse  Quote originally posted by rohnni ...
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.
Moderator
Featured Poster
Reputation Points: 2786
Solved Threads: 873
Code tags enforcer
peter_budo is offline Offline
6,656 posts
since Dec 2004

This thread is more than three months old

No one has posted to this discussion for at least three months. Please let old threads die and do not reply to them unless you feel you have something new and valuable to contribute that absolutely must be added to make the discussion complete. Otherwise, please start a new thread in this forum instead.
Message:
Previous Thread in PHP Forum Timeline: Hello, someone please HELP me
Next Thread in PHP Forum Timeline: xpath Invalid expression





About Us | Contact Us | Advertise | Acceptable Use Policy
Forum Index | Build Custom RSS Feed


Follow us on Twitter


© 2011 DaniWeb® LLC