Mysterious PHP error...

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
bcox
Forum Newbie
Posts: 5
Joined: Fri Jun 25, 2004 12:05 pm
Location: Mission, KS

Mysterious PHP error...

Post by bcox »

For some odd reason, i get the following error, when the code below is executing:

Parse error: parse error, unexpected T_STRING in /home/smnw/public_html/admin/clubs/edit.php on line 26

I have no clue what it is from, and any help or input would be appreciated.

Code: Select all

<?php
/*
clubs.announcements.edit.php

Created By: RB 8/20/04
Revision History:
       RB 8/26/04 - ? - Wrote code
*/
/*
$normStep = apiReadParameter("step");
$add = $_GLOBALS["add"]["boolean"];

if($add == true)
{
       $id = $_GLOBALS["add"]["id"];
       $step = 2;
}
else if($normStep != "")
	$step = $normStep;
else
	$step = 1;
*/
if($step == 1)//list announcements
{
       $userid = apiReadParameter("userid");
       $array = apiReturnAnnouncements($userid);
       echo(apiReadParameter("userName"));
       echo("<br><br><table><tr><td>Teaser</td><td>Date</td></tr>");
       $i = 0;
       while($temp = $array[$i])
       {
               $formFactor = $temp["date"];
               $dateOutput = date("l, M D, Y", $formFactor);
               $teaser = substr($temp["text"], 0, 25);
               echo("<tr><td><a href='http://www.smnw.com/admin/clubs.php?action=edit&step=2&id={$temp["id"]}'>{$title}</a></td><td>{$dateOutput}</td></tr>");
               $i++;
       }
       echo("</table>");
}
else if($step == 2)//make changes
{
       if($add)
       {
               $id = $GLOBALS["add"]["id"];
               $title = "Add Announcement";
       }
       else
       {
               $id = apiReadParameter("id");
               $title = "Edit Announcement";
       }

       $announcement = apiReturnAnnouncement($id);

       echo("{$title}<br><br>
               <form
action='http://www.smnw.com/admin/clubs.php?action=edit&step=3{$link}'
method='post' enctype='multipart/form-data'>
               Title:<input type='text' name='title'
value='{$announcement["title"]}'
size='20' maxlength='35'>
               Text:<br>
               <textarea rows='10' cols='40'
name='text'>{$announcement["text"]}</textarea>
               <br>
               <input type='submit' value='Submit'>
       ");
}
else if($step == 3)//save changes
{
       if(isset($_POST["text"]))
       {
               $add = apiReadParameter("add");
               if(!$add)
               {
                       $oldAnnouncement = apiReturnAnnouncement($id);
                       $insert = "<tr><td><b>Before</b></td><td>{$oldAnnouncement["title"]}</td><td>{$oldAnnouncement["text"]}</td></tr>";
                       $caption = "After";
               }

               $title = apiReadParameter("title");
               $text = apiReadParameter("text");
               $ownerid = apiReadParameter("userid");
               $id = apiReadParameter("id");

               if(apiEditAnnouncement($title, $text, $ownerid, $id))
               {
                       $newAnnouncement = apiReturnAnnouncement($id);
                       $user = apiReadParameter("username");
                       echo("{$user}, SMNW.COM has successfully modified your announcement.
                       <table>
                       {$insert}
                      <tr><td><b>{$caption}</b></td><td>{$newAnnouncement["title"]}</td><td>{$newAnnouncement["text"]}</td></tr>
                       </table>
                       <br>
                       <a href='http://www.smnw.com/admin/clubs.php'>Menu</a>
                       <a href='http://www.smnw.com/admin/logout.php'>Logout</a>
                       ");
               }
       }
       else
               echo("Modification was not successful.  Please try again.  If the problem persists, contact an admin.");
}
else
       echo("How did you get here?");
?>
User avatar
dethron
Forum Contributor
Posts: 370
Joined: Sat Apr 27, 2002 11:39 am
Location: Istanbul

Post by dethron »

why dont you show us, where these functions come from :)
may be u just forget the include functions :)
User avatar
dethron
Forum Contributor
Posts: 370
Joined: Sat Apr 27, 2002 11:39 am
Location: Istanbul

Post by dethron »

check your connection, if you do not have a valid connection, it is like to receive this error.
bcox
Forum Newbie
Posts: 5
Joined: Fri Jun 25, 2004 12:05 pm
Location: Mission, KS

Post by bcox »

The error occurs at the first encounter with any code -- Unexpected T_STRING if it's a string, unexpected T_VARIABLE if it's a variable. The error I put down was actually the error when all the code up to the end of line 25 is commented out. With the code actually shown, it says Unexpected T_VARIABLE on line 25.

At work now (not school) so will post the rest later tonight when I have access to school server.
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post by feyd »

post all your code.
Post Reply