halfpint Posted May 26, 2008 Share Posted May 26, 2008 Hi can anyone see where the error is in this bit of code as it keeps comming up with a parse error on this line echo("<a href="page.php?page=memberlist&p=$prev_page">< Prev</a>"); thanks in advance Link to comment https://forums.phpfreaks.com/topic/107299-solved-parse-error/ Share on other sites More sharing options...
trq Posted May 26, 2008 Share Posted May 26, 2008 echo "<a href=\"page.php?page=memberlist&p=$prev_page\">< Prev</a>"; Link to comment https://forums.phpfreaks.com/topic/107299-solved-parse-error/#findComment-550165 Share on other sites More sharing options...
halfpint Posted May 26, 2008 Author Share Posted May 26, 2008 ahh thank you very much Link to comment https://forums.phpfreaks.com/topic/107299-solved-parse-error/#findComment-550166 Share on other sites More sharing options...
Chezshire Posted May 26, 2008 Share Posted May 26, 2008 Why was the '(' at the beginnning of the code considered to be a 'parse' error? Parse errors and T-Strings confuse me and i'm trying to understand what they are so i can resolve them as they are my most common mistake. thanks! Chez Link to comment https://forums.phpfreaks.com/topic/107299-solved-parse-error/#findComment-550275 Share on other sites More sharing options...
trq Posted May 27, 2008 Share Posted May 27, 2008 The ( had nothing to do with it. echo is a language construct not a function, hence does not require () around its arguments (this is however beside the point). The problem was the fact that you had unescaped double quotes within a double quote encapsulated string. In order to use double quotes within a double quote encapsulated string they need to be escaped (using the \ (backslash) character). Otherwise, you could have used single quotes. Some working examples of how your code could have been written. <?php echo "<a href=\"page.php?page=memberlist&p=$prev_page\">< Prev</a>"; echo "<a href='page.php?page=memberlist&p=$prev_page'>< Prev</a>"; echo '<a href="page.php?page=memberlist&p=' . $prev_page . '">< Prev</a>'; ?> Link to comment https://forums.phpfreaks.com/topic/107299-solved-parse-error/#findComment-550544 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.