Jump to content

Unable to locate parse error.


Texan78
Go to solution Solved by Barand,

Recommended Posts

Ok I have a small issue. I know it's because of my lack of php knowledge and it's a small mistake but I can't seem to see it.

 

I am getting this error in Coda 2.0

 

Parse error: parse error, expecting `','' or `';'' in - on line 216
Errors parsing -

 

Which is referring to this line of code. All I did was  add echo and wrap <td> tags around it and it starting throwing the error.

echo "<td>"getGraphic($realIndex1, $aqiLevels, $aqiGraphic, $imagesDir)"</td>";

Here is this complete little script that the line above is extracted from.

<table style="margin: 0px auto;" border="0" width="80%">
     <tbody><tr><?php
  if ($useAQI) {  //  Show Air Quality Index - PLASE YOUR CODE IN PLACE OF THIS SECTION AND START HERE Removing the line above too!
?>
<?php
if ($realValue1 == "") {
  echo "";
} else {
  echo "<td style=\"text-decoration: none; text-align: center;\"><span style=\"font-size:90%; \">Quality<br/>Index<sup>6</sup>:</span><span style=\"font-size: 150%; font-weight:bold;\"><br/>" .$realValue1."</span></td>";
}
if ($realValue1 == "") {
  echo "Data Not<br />Available</span><br /><br /><img src=\"./ajax-images/AQI0.jpg\" width=\"75\" height=\"75\" alt=\"Data Not Available\" />";
} else {
 echo "<td>"getGraphic($realIndex1, $aqiLevels, $aqiGraphic, $imagesDir)"</td>";
}
?>
       <td style="text-decoration: none; text-align: center;"><span style="font-size:85%;"><?php langtrans('Density'); ?>:<br />
        <?php echo $airdensity . " kg/m<sup>3</sup>" ?></span></td>

        </tr>
<?php } // end $showAQI - PLASE YOUR CODE INPLACE OF THIS SECTION AND END HERE  ?></td>
     </tr>
    </tbody></table>

What is it that I am not seeing?

 

-Thanks

Link to comment
Share on other sites

  • Solution

Either concatenate the expressions with periods or separate them with commas

echo "<td>", getGraphic($realIndex1, $aqiLevels, $aqiGraphic, $imagesDir), "</td>";

or

echo "<td>" . getGraphic($realIndex1, $aqiLevels, $aqiGraphic, $imagesDir) . "</td>";
Edited by Barand
Link to comment
Share on other sites

Thanks, that works but it throws off the alignment. Least I know for reference what the issue was case it happens in the future. I knew it was something simple but I am still learning proper syntax. I was able to get it to work this way as well and it aligns the way I need it. Not sure if this is proper or not but, it works too for now. Still to be determined if not having it after the else statement is going to cause any issues.  

<table style="margin: 0px auto;" border="0" width="80%">
     <tbody><tr><?php
  if ($useAQI) {  //  Show Air Quality Index - PLASE YOUR CODE IN PLACE OF THIS SECTION AND START HERE Removing the line above too!
?>
<?php
if ($realValue1 == "") {
  echo "";
} else {
  echo "<td style=\"text-decoration: none; text-align: center;\"><span style=\"font-size:90%; \">Quality<br/>Index<sup>6</sup>:</span><span style=\"font-size: 150%; font-weight:bold;\"><br/>" .$realValue1."</span></td>";
}
if ($realValue1 == "") {
  echo "Data Not<br />Available</span><br /><br /><img src=\"./ajax-images/AQI0.jpg\" width=\"50\" height=\"50\" alt=\"Data Not Available\" />";
}?>

     <td style="text-decoration: none; text-align: center;"><? echo getGraphic($realIndex1, $aqiLevels, $aqiGraphic, $imagesDir); ?></td>


       <td style="text-decoration: none; text-align: center;"><span style="font-size:85%;"><?php langtrans('Density'); ?>:<br />
        <?php echo $airdensity . " kg/m<sup>3</sup>" ?></span></td>

        </tr>
<?php } // end $showAQI - PLASE YOUR CODE INPLACE OF THIS SECTION AND END HERE  ?></td>
     </tr>
    </tbody></table>

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.