Texan78 Posted May 12, 2013 Share Posted May 12, 2013 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 216Errors 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 Quote Link to comment https://forums.phpfreaks.com/topic/277929-unable-to-locate-parse-error/ Share on other sites More sharing options...
Solution Barand Posted May 12, 2013 Solution Share Posted May 12, 2013 (edited) 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 May 12, 2013 by Barand Quote Link to comment https://forums.phpfreaks.com/topic/277929-unable-to-locate-parse-error/#findComment-1429726 Share on other sites More sharing options...
Texan78 Posted May 12, 2013 Author Share Posted May 12, 2013 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> Quote Link to comment https://forums.phpfreaks.com/topic/277929-unable-to-locate-parse-error/#findComment-1429729 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.