jhinckley Posted December 14, 2011 Share Posted December 14, 2011 First post here from a php n00bcakes so please be gentle. For some reason I keep getting a parse error on this code and I can't figure out why. Here is the error: PHP Syntax Check: Parse error: syntax error, unexpected T_VARIABLE, expecting ',' or ';' in your code on line 6 Here is the code: <?php $count = 1; while ($count <= 10) { $square = $count * $count; Echo "$count squared is $square <br>;" $count++; } ?> It doesn't like something about $count++; and I can't figure out what. :-\ The sad part...this code is straight out of a PHP book. :/ Thanks in advance! -jhinckley Quote Link to comment https://forums.phpfreaks.com/topic/253186-parse-error/ Share on other sites More sharing options...
kicken Posted December 14, 2011 Share Posted December 14, 2011 Echo "$count squared is $square <br>;" $count++; Your missing your ; at the end of the echo statement. It looks like maybe you just transposed the quote and the semi-colon. Quote Link to comment https://forums.phpfreaks.com/topic/253186-parse-error/#findComment-1297969 Share on other sites More sharing options...
jhinckley Posted December 14, 2011 Author Share Posted December 14, 2011 Your missing your ; at the end of the echo statement. It looks like maybe you just transposed the quote and the semi-colon. Doh! That was it. Thank you! Quote Link to comment https://forums.phpfreaks.com/topic/253186-parse-error/#findComment-1297971 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.