Jump to content

$end error


bravo14

Recommended Posts

Hi Guys

 

When I load the page with this code I get an error of

Parse error: syntax error, unexpected $end in /home/sites/yardleyhc.co.uk/public_html/bravo14/admin/add_report.php on line 86

 

<?php
//Check if user is logged in
session_start();
if (!isset($_SESSION['logname']))
{
header ("Location: login.php");
}
?>

<?php
//connect to db
include_once('includes/connect.php');
if ($_POST['submit_form'] == 1)  { 
$data = mysql_real_escape_string(trim($_POST['fcktext'])); 
$match = ($_POST['match']);
$headline = ($_POST['title']);
$intro = substr ($data,0,100);
	// Save to the database 
    $res = mysql_query("INSERT INTO tbl_reports (match_id, story, headline,intro) VALUES('$match','$data','$headline','$intro')");
    
    if (!$res) 
      die("Error saving the record!  Mysql said: ".mysql_error()); 
     
    // Redirect to self to get rid of the POST 
$message = "The scorer has been added"; 
  }
      include_once "includes/fckeditor/fckeditor.php"; 
  ?>
  <!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=utf-8" />
<title>• Yardley Hockey Club • Admin • Amend Home Page Content •</title>
<link href="../style/2008.css" rel="stylesheet" type="text/css" />
</head>

<body>
<div align="center">
<div id="maincontent">
<div id="header"><img src="../images/logo.gif" /><img src="../images/yardley.png" /></div>
<div id="maintext">
<div><a href="javascript:history.go(-1)"><img src="includes/icons/back.png" border="0" alt="Go back to Previous page" /></a></div>

<?php
if (isset ($message))
{
echo($message);
}
else
{
  echo('<form method="post" action="add_report.php">');
  echo('<table>');
echo ('<tr><td><select name="match"><option>Please select Fixture</option>');
$fixtures=mysql_query('SELECT * FROM `tbl_fixture_dates` INNER JOIN `tbl_fixtures` ON `tbl_fixture_dates`.`date_id` = `tbl_fixtures`.`date_id` WHERE `tbl_fixtures`.`team_id` =  \'' . $_GET['team_id'] . '\' order by match_date');
if(mysql_num_rows($fixtures)==0) 
echo('<option>there is no data in table..</option>');
else
{
while($matchrow=mysql_fetch_assoc($fixtures))
{
echo "<option value=".$matchrow[match_id].">".date("d-M-Y", strtotime($matchrow[Date]))."|".$matchrow[Opposition]."</option>";
}
}
echo ('</select></td></tr>');
echo('<tr><td><input name="title" type="text" value="Enter Headline Here..." size="70" class="button"/></td></tr>');
echo ('<tr><td>');
  $oFCKeditor = new FCKeditor('fcktext'); 
  $oFCKeditor->BasePath = "includes/fckeditor/"; 
  $oFCKeditor->Value    = ""; 
  $oFCKeditor->Width    = 540; 
  $oFCKeditor->Height   = 400; 
  echo $oFCKeditor->CreateHtml(); 
echo ('</td></tr>');
echo ('<br /> ');
echo('<tr><td><input type="hidden" name="submit_form" value="1" /> </td></tr>
<tr><td><input type="submit" value="Save Post" class="button"/> </td></tr>
</table>
</form>');
?>

</div>
</div>
</div>
</body>
</html>

 

Probably just missed something obvious, but can't see it

 

Cheers

Link to comment
Share on other sites

By the looks of it, there are 4 "{" in this section and only 3 "}", i suspect it has something to do with the line "if(mysql_num_rows($fixtures)==0) ", not really read through what your code is trying to do though

 

<?php
if (isset ($message))
{
echo($message);
}
else
{
  echo('<form method="post" action="add_report.php">');
  echo('<table>');
   echo ('<tr><td><select name="match"><option>Please select Fixture</option>');
   $fixtures=mysql_query('SELECT * FROM `tbl_fixture_dates` INNER JOIN `tbl_fixtures` ON `tbl_fixture_dates`.`date_id` = `tbl_fixtures`.`date_id` WHERE `tbl_fixtures`.`team_id` =  \'' . $_GET['team_id'] . '\' order by match_date');
if(mysql_num_rows($fixtures)==0) 
echo('<option>there is no data in table..</option>');
else
{
while($matchrow=mysql_fetch_assoc($fixtures))
{
echo "<option value=".$matchrow[match_id].">".date("d-M-Y", strtotime($matchrow[Date]))."|".$matchrow[Opposition]."</option>";
}
}
echo ('</select></td></tr>');
echo('<tr><td><input name="title" type="text" value="Enter Headline Here..." size="70" class="button"/></td></tr>');
echo ('<tr><td>');
  $oFCKeditor = new FCKeditor('fcktext'); 
  $oFCKeditor->BasePath = "includes/fckeditor/"; 
  $oFCKeditor->Value    = ""; 
  $oFCKeditor->Width    = 540; 
  $oFCKeditor->Height   = 400; 
  echo $oFCKeditor->CreateHtml(); 
echo ('</td></tr>');
echo ('<br /> ');
echo('<tr><td><input type="hidden" name="submit_form" value="1" /> </td></tr>
<tr><td><input type="submit" value="Save Post" class="button"/> </td></tr>
</table>
</form>');
?>

Link to comment
Share on other sites

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.