Jump to content

unexpected $end and all checks made


mb326

Recommended Posts

Hi, I'm getting an unexpected $end in this code.

 

I have checked for: missing or extra curly braces, forgetting semicolons, trying single and double-quote strings for the HTML tags

and still I can't get rid of the error. What aspect have I left out?

 

 

<?php

$rootPath = './';
include($rootPath.'include/session.php');
include($rootPath.'include/template.php');
include('StudentContact.class.php');
$template = new Template('Print Event Details', $rootPath);
global $database;

echo $template->header();

// Display the form header
$content = "<div class =\"section\"><H1>Find an Event</H1>\n";

// retrieve the details from the print details form
$eventID = $_POST['eventID'];

// query username is present
$query = <<<ENDOFSTRING
  SELECT * FROM EventCalendar WHERE eventID = '$eventID' ENDOFSTRING;

// makes a call to mySQL query
$result = $database->query($query);

if(!$query)
{
exit("Student details not found \n");
}
else
{
// print out all student details
$results = mysql_fetch_assoc($result);
// print the results
echo '<p> The details of event number $results->eventID :\n </p>'; 
// outline table headers
echo '<p> Event Organiser: 	$results->eventOrganiser\n </p>'; // with table tags
echo '<p> Description: 		$results->eventDesc\n </p>';
echo '<p> Time of Event:	$results->timestamp\n </p>';
echo '<p> Location:			$reuslts->location\n </p>';
echo '<p> Cost:				£$results->cost\n </p>';
echo '<p> Min Attendance:	$reuslts->min_attend\n </p>';
echo '<p> Max Attendance:	$reuslts->max_attend\n </p>';
}

//--Display the form--
$content .= '</div>';
echo $content;

echo $template->footer();

?>

Link to comment
https://forums.phpfreaks.com/topic/101895-unexpected-end-and-all-checks-made/
Share on other sites

You can tell from the color highlighting the forum software did in the post, approximately where the problem is. Your heredoc end tag is not in column one on a line by it self -

 

The closing identifier must begin in the first column of the line. Also, the identifier used must follow the same naming rules as any other label in PHP: it must contain only alphanumeric characters and underscores, and must start with a non-digit character or underscore.

 

Warning

It is very important to note that the line with the closing identifier contains no other characters, except possibly a semicolon (;). That means especially that the identifier may not be indented, and there may not be any spaces or tabs after or before the semicolon. It's also important to realize that the first character before the closing identifier must be a newline as defined by your operating system. This is \r on Macintosh for example. Closing delimiter (possibly followed by a semicolon) must be followed by a newline too.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.