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

Posted on 2011-04-29
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

    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
    are you sure the variables are getting values to the query?
    LVL 39

    Accepted Solution

    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' />";

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    How your wiki can always stay up-to-date

    Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
    - Increase transparency
    - Onboard new hires faster
    - Access from mobile/offline

    Suggested Solutions

    Introduction Many web sites contain image galleries; a common design for these galleries includes a page with a collection of thumbnail images.  You can click on each of the thumbnail images to see the larger version of the image.  This is easily i…
    Generating table dynamically is the most common issue faced by php developers.... So it seems there is a need of an article that explains the basic concept of generating tables dynamically. It just requires a basic knowledge of html and little maths…
    The viewer will learn how to count occurrences of each item in an array.
    The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …

    761 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

    Need Help in Real-Time?

    Connect with top rated Experts

    14 Experts available now in Live!

    Get 1:1 Help Now