andy_b_1502 Posted April 29, 2012 Share Posted April 29, 2012 Hi everyone. Can someone help me fix this code: <?PHP include('db.php); $query = "SELECT * FROM companies; $result = mysql_query($query) ; while ( $row = mysql_fetch_array($result)) { echo $row['what_services'] . " - " . strlen($row['what_services']); } ?> on line 6 it has a parse error: Parse error: syntax error, unexpected T_STRING in /hermes/bosweb25a/b109/ipg.removalspacecom/services_001.php on line 6 Quote Link to comment https://forums.phpfreaks.com/topic/261805-parse-error/ Share on other sites More sharing options...
KevinM1 Posted April 29, 2012 Share Posted April 29, 2012 Look at your double quotes.... Quote Link to comment https://forums.phpfreaks.com/topic/261805-parse-error/#findComment-1341539 Share on other sites More sharing options...
andy_b_1502 Posted April 29, 2012 Author Share Posted April 29, 2012 there's an open but dont know where to close? where do they go? Quote Link to comment https://forums.phpfreaks.com/topic/261805-parse-error/#findComment-1341542 Share on other sites More sharing options...
PFMaBiSmAd Posted April 29, 2012 Share Posted April 29, 2012 And the single-quote(s) above those... You need to be using an editor with code highlighting and use <?php (lowercase) for your opening php tag (at least the forum highlighting doesn't see the <?PHP, perhaps your current editor doesn't either.) Quote Link to comment https://forums.phpfreaks.com/topic/261805-parse-error/#findComment-1341543 Share on other sites More sharing options...
andy_b_1502 Posted April 29, 2012 Author Share Posted April 29, 2012 which editor would you suggest using? im using dreamweaver at the minute? Quote Link to comment https://forums.phpfreaks.com/topic/261805-parse-error/#findComment-1341544 Share on other sites More sharing options...
andy_b_1502 Posted April 29, 2012 Author Share Posted April 29, 2012 the correct code is this, thanks guys <?PHP include('db.php'); $query = "SELECT * FROM companies"; $result = mysql_query($query); while ( $row = mysql_fetch_array($result)) { echo $row['what_services'] . " - " . strlen($row['what_services']); } ?> Quote Link to comment https://forums.phpfreaks.com/topic/261805-parse-error/#findComment-1341545 Share on other sites More sharing options...
PFMaBiSmAd Posted April 29, 2012 Share Posted April 29, 2012 I use notepad++ - http://notepad-plus-plus.org/ Dreamweaver has never been very server-side code aware. Quote Link to comment https://forums.phpfreaks.com/topic/261805-parse-error/#findComment-1341546 Share on other sites More sharing options...
Jessica Posted April 30, 2012 Share Posted April 30, 2012 I've always used TextPad but just recently switched to jEdit for the SFTP support. Quote Link to comment https://forums.phpfreaks.com/topic/261805-parse-error/#findComment-1341688 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.