jarv Posted June 27, 2008 Share Posted June 27, 2008 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! Quote Link to comment Share on other sites More sharing options...
ScotDiddle Posted June 27, 2008 Share Posted June 27, 2008 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 Quote Link to comment Share on other sites More sharing options...
jarv Posted June 27, 2008 Author Share Posted June 27, 2008 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); ?> Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.