Skip to main content
July 16, 2009
Answered

Parse error: syntax error, unexpected $end

  • July 16, 2009
  • 1 reply
  • 1490 views

I have this following code in a file to reformat the date.

<?php do {
$timeDate = $row_rsIndex['timeDate'];
$date = date("M j, Y",strtotime("$timeDate"));
?>

When I use this code in another file to reformat the date, I get this error. "Parse error:  syntax error, unexpected $end in /home/content/e/v/e/everfoundmusic/html/test/tour_main.php on line 148"

Any ideas what the problem is? I've tried googling it but didnt find an answer.

Here is the php.

<?php require_once('Connections/everfoundapp.php'); ?>
<?php
if (!function_exists("GetSQLValueString")) {
function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")
{
  if (PHP_VERSION < 6) {
    $theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;
  }

  $theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);

  switch ($theType) {
    case "text":
      $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
      break;   
    case "long":
    case "int":
      $theValue = ($theValue != "") ? intval($theValue) : "NULL";
      break;
    case "double":
      $theValue = ($theValue != "") ? doubleval($theValue) : "NULL";
      break;
    case "date":
      $theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";
      break;
    case "defined":
      $theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;
      break;
  }
  return $theValue;
}
}

mysql_select_db($database_everfoundapp, $everfoundapp);
$query_rsIndex = "SELECT * FROM tour WHERE timeDate >= CURDATE() ORDER BY timeDate DESC";
$rsIndex = mysql_query($query_rsIndex, $everfoundapp) or die(mysql_error());
$row_rsIndex = mysql_fetch_assoc($rsIndex);
$totalRows_rsIndex = mysql_num_rows($rsIndex);

$colname_rsDetails = "-1";
if (isset($_GET['id'])) {
  $colname_rsDetails = $_GET['id'];
}
mysql_select_db($database_everfoundapp, $everfoundapp);
$query_rsDetails = sprintf("SELECT * FROM tour WHERE id = %s", GetSQLValueString($colname_rsDetails, "int"));
$rsDetails = mysql_query($query_rsDetails, $everfoundapp) or die(mysql_error());
$row_rsDetails = mysql_fetch_assoc($rsDetails);
$totalRows_rsDetails = mysql_num_rows($rsDetails);
?>

<?php do {
$timeDate = $row_rsIndex['timeDate'];
$date = date("M j, Y",strtotime("$timeDate"));
?>

         


<!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>Tour Schedule</title>
<link href="style_tour_main.css" rel="stylesheet" type="text/css" />
</head>

<body>
<?php
// Show IF id not sent
if (@$_GET['id'] == "") {
?>

<table width="608" border="0" cellspacing="0" cellpadding="0">
  <tr>
    <th width="60" align="left" valign="top" scope="row"><strong>Date</strong></th>
    <td width="150" align="left" valign="top"><strong>City | State</strong></td>
    <td width="247" height="30" align="left" valign="top"><strong>Venue</strong></td>
    <td width="161" align="left" valign="top"><strong>Info</strong></td>
  </tr>
</table>
<!-- START index -->
   
     <table width="608" border="0" cellpadding="0" cellspacing="0">
        
      <?php do { ?>
      <tr>
            <td width="60" height="19" align="left" valign="top"><a href="tour_main.php?id=<?php echo $row_rsIndex['id']; ?>"><?php echo $row_rsIndex['timeDate']; ?><br />
            </a></td>
<td width="150" align="left" valign="top"><a href="tour.php?id=<?php echo $row_rsIndex['id']; ?>"> </a><a href="tour_main.php?id=<?php echo $row_rsIndex['id']; ?>"><?php echo $row_rsIndex['addrCity']; ?>, </a><a href="tour_main.php?id=<?php echo $row_rsIndex['id']; ?>"><?php echo $row_rsIndex['addrState']; ?></a></td>
        <td width="247" align="left" valign="top"><a href="tour_main.php?id=<?php echo $row_rsIndex['id']; ?>"><?php echo $row_rsIndex['venue']; ?></a></td>
        <td width="161" align="left" valign="top"><a href="tour_main.php?id=<?php echo $row_rsIndex['id']; ?>"><em>MORE INFO</em></a></td>
      </tr>
      <tr>
        <td colspan="4" align="left" valign="top" class="space">  </td>
      </tr>
      <?php } while ($row_rsIndex = mysql_fetch_assoc($rsIndex)); ?>
</table>
<!-- END index -->


<!-- START details -->
<? } else { ?>


<h6><a href="tour_main.php">&laquo; Back to Tour Schedule</a></h6>
<h1><?php echo $row_rsDetails['timeDate']; ?> - <?php echo $row_rsDetails['addrCity']; ?>, <?php echo $row_rsDetails['addrState']; ?></h1>

<table cellspacing="4">
  <tr>
         <td width="61"><b>Time:</b></td>
        <td width="207" class="dtext"><?php echo $row_rsDetails['timeTime']; ?></td>
    </tr>
   
    <tr>
         <td><b>Venue:</b></td>
        <td class="dtext"><?php echo $row_rsDetails['venue']; ?></td>
    </tr>
   
    <tr>
         <td valign="top"><b>Location:</b></td>
        <td class="dtext"><?php echo $row_rsDetails['addrAddress']; ?><br />
               <?php echo $row_rsDetails['addrCity']; ?>, <?php echo $row_rsDetails['addrState']; ?> <?php echo $row_rsDetails['addrZip']; ?><br />
       <?php echo $row_rsDetails['addrCountry']; ?></td>
    </tr>
   
    <tr>
         <td><b>Cost:</b></td>
        <td class="dtext">$<?php echo $row_rsDetails['cost']; ?></td>
    </tr>
   
    <tr>
         <td valign="top"><b>Details:</b></td>
        <td class="dtext"><?php echo $row_rsDetails['description']; ?></td>
    </tr>
</table>


<?php }
// endif id is sent
?>
<!-- END details -->
</body>
</html>
<?php
mysql_free_result($rsIndex);

mysql_free_result($rsDetails);
?>

This topic has been closed for replies.
Correct answer

Hello there.. You should change this one

<!-- START index -->
   
     <table width=
"608" border="0" cellpadding="0" cellspacing="0">
        
      <?php do { ?>
      <tr>
            <td width=
"60" height="19" align="left" valign="top"><a href="tour_main.php?id=<?php echo $row_rsIndex['id']; ?>"><?php echo $row_rsIndex['timeDate']; ?><br />
            </a></td>

to this

<!-- START index -->
   
     <table width=
"608" border="0" cellpadding="0" cellspacing="0">
        
      <?php do {
          $timeDate = $row_rsIndex['timeDate'];
          $date = date("M j, Y",strtotime("$timeDate"));

      ?>
      <tr>
            <td width=
"60" height="19" align="left" valign="top"><a href="tour_main.php?id=<?php echo $row_rsIndex['id']; ?>"><?php echo $date; ?><br />
            </a></td>

1 reply

Correct answer
July 17, 2009

Hello there.. You should change this one

<!-- START index -->
   
     <table width=
"608" border="0" cellpadding="0" cellspacing="0">
        
      <?php do { ?>
      <tr>
            <td width=
"60" height="19" align="left" valign="top"><a href="tour_main.php?id=<?php echo $row_rsIndex['id']; ?>"><?php echo $row_rsIndex['timeDate']; ?><br />
            </a></td>

to this

<!-- START index -->
   
     <table width=
"608" border="0" cellpadding="0" cellspacing="0">
        
      <?php do {
          $timeDate = $row_rsIndex['timeDate'];
          $date = date("M j, Y",strtotime("$timeDate"));

      ?>
      <tr>
            <td width=
"60" height="19" align="left" valign="top"><a href="tour_main.php?id=<?php echo $row_rsIndex['id']; ?>"><?php echo $date; ?><br />
            </a></td>
July 17, 2009

You saved me once again. Thank you!