syntax error, unexpected T_STRING, expecting ',' or ';' in line 5

Posted on 2011-04-29
Medium Priority
Last Modified: 2012-05-11
HI Experts

I am trying to add an icon to the output of a php snippet and get the following error

syntax error, unexpected T_STRING, expecting ',' or ';' in line 5

The code snippet is below. I have separated the block to make easier to see.
Could you indicate what I have done wrong please.


$query_silotreeLevel2 = "SELECT theme_keywords, SiloID, SiloFlag, CompetingPages, theme_keywordsid FROM theme_keywords WHERE SiloID = " . addslashes($rw_silotreeLevel1['theme_keywordsid']) . " AND SiloFlag='Article' ORDER By SiloNavOrder ASC, CompetingPages DESC";
$silotreeLevel2 = mysql_query($query_silotreeLevel2, $dws) or die(mysql_error());
while ($rw_silotreeLevel2 = mysql_fetch_assoc($silotreeLevel2)) {

if($rw_silotreeLevel2['CompetingPages'] > $rw_silotreeLevel1['CompetingPages']) {
      echo '<img src="images/ico_alpha_CheckMarkGreen_16x16.png" alt="Passed" title="Passed" width="16" height="16" />';
      }else{echo '<img src="images/ico_alpha_CheckMarkGreen_16x16.png" alt="Passed" title="Passed" width="16" height="16" />';

  $silotreeL2 = '<span class="silotree_level2"><span class="silotree_opener">';
  $silotreeL2 .= '<img src="FXInc/none.gif" width="16">';
  $silotreeL2 .= '</span><span><a href="inc.update.root.keyword.php?profileid=' .$_GET['profileid']. '&clid=' .$_GET['clid']. '&tkid=' . addslashes($rw_silotreeLevel2['theme_keywordsid']) . '&theme_keywordsid=' . addslashes($rw_silotreeLevel2['theme_keywordsid']) . '&tkw=' . addslashes($rw_silotreeLevel2['theme_keywords']) . '&returnPath='.$file.'" target="_blank" rel="width:850,height:550,ajax:true" id="pf_multiBox1" class="pf_multiBox1" title="'. $rw_silotreeLevel2['theme_keywords'] .' | ID:'. $rw_silotreeLevel2['theme_keywordsid'] .'">';
  if ($FX_imgdecsilotree) $silotreeL2 .= '<img src="' . $FX_imgcontsilotree . '" id="silotree__'.$i1.'_'.$i2.'_F">';
  $silotreeL2 .= '<span class="silotree_category">' . $rw_silotreeLevel2['theme_keywords'].'</span></a></span></span>'."\n";
  $silotreeL2 .= '<div id="silotree__'.$i1.'_'.$i2.'_S">'."\n";
  $silotree["L2"][$i1-1][] = $silotreeL2;
$i3 = 1;
Question by:matthewdacruz

Author Comment

ID: 35490616
Sorry I have fixed the icon duplicate issue in the if stament but have the same syntax error.

if($rw_silotreeLevel2['CompetingPages'] > $rw_silotreeLevel1['CompetingPages']) {
      echo '<img src="images/ico_alpha_Delete_16x16.png" alt="Failed" title="Failed" width="16" height="16" />';
      }else{echo '<img src="images/ico_alpha_CheckMarkGreen_16x16.png" alt="Passed" title="Passed" width="16" height="16" />';
LVL 36

Expert Comment

by:Loganathan Natarajan
ID: 35490622
are you sure the variables are getting values to the query?
LVL 39

Accepted Solution

Pratima Pharande earned 2000 total points
ID: 35490649
if($rw_silotreeLevel2['CompetingPages'] > $rw_silotreeLevel1['CompetingPages']) {
      echo "<img src='images/ico_alpha_Delete_16x16.png' alt='Failed' title='Failed' width='16' height='16' />";
      }else{echo "<img src='images/ico_alpha_CheckMarkGreen_16x16.png' alt='Passed' title='Passed' width='16' height='16' />";

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Nothing in an HTTP request can be trusted, including HTTP headers and form data.  A form token is a tool that can be used to guard against request forgeries (CSRF).  This article shows an improved approach to form tokens, making it more difficult to…
This holiday season, we’re giving away the gift of knowledge—tech knowledge, that is. Keep reading to see what hacks, tips, and trends we have wrapped and waiting for you under the tree.
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.
Suggested Courses
Course of the Month16 days, 14 hours left to enroll

862 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question