Far Cry Posted June 21, 2010 Share Posted June 21, 2010 I am working on this file (index.php). CODE: <?php include_once 'connection.php'; $query = "Select * from news WHERE Page = 1"; $result = mysql_query($query); while($post = mysql_fetch_array($result)) ( echo "<h1>" . $row['Post_Title'] . "</h1><br>"; echo "<h3>" . $row['Post_Author'] . "</h3><br>"; echo "<p>" . $row['Post_Content'] . "</p>"; ) ?> Every time I try to open it up in my browser I get this error: Parse error: syntax error, unexpected T_ECHO in /home/latestne/public_html/index2.php on line 8 If you guys can help me fix this error that would be great, thanks in advance Link to comment https://forums.phpfreaks.com/topic/205454-parse-error-syntax-error-unexpected-t_echo/ Share on other sites More sharing options...
Mchl Posted June 21, 2010 Share Posted June 21, 2010 () is not the same as {} Link to comment https://forums.phpfreaks.com/topic/205454-parse-error-syntax-error-unexpected-t_echo/#findComment-1075154 Share on other sites More sharing options...
dabaR Posted June 21, 2010 Share Posted June 21, 2010 <?php while($post = mysql_fetch_array($result)) ( echo "<h1>" . $row['Post_Title'] . "</h1><br>"; echo "<h3>" . $row['Post_Author'] . "</h3><br>"; echo "<p>" . $row['Post_Content'] . "</p>"; ) ?> Should be while() { ... } not while () ( ... ) Link to comment https://forums.phpfreaks.com/topic/205454-parse-error-syntax-error-unexpected-t_echo/#findComment-1075155 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.