Jump to content

Parse error: syntax error, ...


jarv

Recommended Posts

Parse error: syntax error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING in /Users/staff/Sites/johns/headers/display.php on line 46

 

line 46:

 $Keyword = $row1['keyword'];

 

here is all my code:

<?php
include_once("config.php");
include_once("functions.php");
// Check user logged in already:
// checkLoggedIn("yes");
doCSS(); ?>
<div id="header">
<p class="wrap">

<? print("\n <a href=\"post.php"."\">+ Add new header</a> ");?>
</p>
<h1 class="wrap">Avert Weekly Headers</h1>
</div>
<?
include_once("config.php");
$result = mysql_query("SELECT * FROM Headertbl ORDER BY HeaderDate DESC");


while($row = mysql_fetch_array($result)){


echo '<div id="entry" class="wrap">';
$HeaderID = $row['HeaderID'];
$HeaderImage = $row['HeaderImage'];
$HeaderDate = $row['HeaderDate'];
$HeaderPhotoNo = $row['HeaderPhotoNo'];
$HeaderName = $row['HeaderName'];
$PhotoID = $row['PhotoID'];
$CountryID = $row['CountryID'];

$result1 = mysql_fetch_array(mysql_query("SELECT * FROM country WHERE CountryID =".$CountryID));
$Country = $result1['country'];

$result2 = mysql_query("SELECT * FROM keywordlist LEFT JOIN keyword ON keywordlist.keyword_id=keyword.keyword_id WHERE HeaderID =".$HeaderID);

while($row1 = mysql_fetch_array($result2)){


echo <<<EOF

  <div class="entry_header">
    <b>Header Name:</b> $HeaderName <a href="edit.php?HeaderID=$HeaderID">Edit Header</a> | <a href="delete.php?HeaderID=$HeaderID">Delete Header</a><br />
<a href="upload.php?HeaderID=$HeaderID">Change Header</a><br />
<a href="http://www.avert.org/photo_search.php?search_keyword_id=&search_country_id=country-$CountryID&page_type=thumbnails&search=search">Other pictures from $Country</a> Keywords:

  $Keyword = $row1['keyword'];
  $Keyword
  EOF;
  }<br />
<b>PhotoID:</b> $PhotoID <br />
<b>Header Photo No:</b> $HeaderPhotoNo <br />
<b>Header Date:</b> $HeaderDate <br />
<img src="headers/$HeaderImage">
  </div>
EOF;
echo '</div>';

}

mysql_close($link);
?>

 

please help!

Link to comment
Share on other sites

jarv,

 

After pasting your code into Zend Studio 5.5 IDE, two probmems were immediately apparent.

 

1. There is no closing '}' for your first 'While' Statement.

 

2. You cannont have and assigment in a HEREDOC string... Move your assignment:

 

        $Keyword = $row1['keyword'];

     

        above your 'echo <<<' statement.

 

      The error message relates to this statement.  (Line 46)

 

Scot L. Diddle, Richmond VA

Link to comment
Share on other sites

thanks, I have sort of got it working, I just need to loop through $result2 but not sure about how to do this?!

 

 

<?php
include_once("config.php");
include_once("functions.php");
// Check user logged in already:
// checkLoggedIn("yes");
doCSS(); ?>
<div id="header">
<p class="wrap">

<? print("\n <a href=\"post.php"."\">+ Add new header</a> ");?>
</p>
<h1 class="wrap">Avert Weekly Headers</h1>
</div>
<?
include_once("config.php");
$result = mysql_query("SELECT * FROM Headertbl ORDER BY HeaderDate DESC");


while($row = mysql_fetch_array($result)){


echo '<div id="entry" class="wrap">';
$HeaderID = $row['HeaderID'];
$HeaderImage = $row['HeaderImage'];
$HeaderDate = $row['HeaderDate'];
$HeaderPhotoNo = $row['HeaderPhotoNo'];
$HeaderName = $row['HeaderName'];
$PhotoID = $row['PhotoID'];
$CountryID = $row['CountryID'];

$result1 = mysql_fetch_array(mysql_query("SELECT * FROM country WHERE CountryID =".$CountryID));
$Country = $result1['country'];

$result2 = mysql_query("SELECT * FROM keyword INNER JOIN keywordlist ON keyword.keyword_id=keywordlist.keyword_id WHERE keyword.HeaderID=".$HeaderID);

while($row1 = mysql_fetch_array($result2))
  $Keyword = $row1['keyword'];


echo <<<EOF

  <div class="entry_header">
    <b>Header Name:</b> $HeaderName <a href="edit.php?HeaderID=$HeaderID">Edit Header</a> | <a href="delete.php?HeaderID=$HeaderID">Delete Header</a><br />
<a href="upload.php?HeaderID=$HeaderID">Change Header</a><br />
<a href="http://www.avert.org/photo_search.php?search_keyword_id=&search_country_id=country-$CountryID&page_type=thumbnails&search=search">Other pictures from $Country</a> Keywords:{$Keyword}
  <br />
<b>PhotoID:</b> $PhotoID <br />
<b>Header Photo No:</b> $HeaderPhotoNo <br />
<b>Header Date:</b> $HeaderDate <br />
<img src="headers/$HeaderImage">
  </div>
EOF;
echo '</div>';
}
mysql_close($link);
?>

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.