DangerM0use Posted March 12, 2007 Share Posted March 12, 2007 I can't figure out why I am getting the following error; Parse error: syntax error, unexpected $end in /misc/27/000/107/398/6/user/web/xb-online.net/testing/article1.php on line 50 for the following code. <html> <head> <title>Website article test version</title> </head> <body> <?php if(empty($_GET['id'])) { echo "<p class='error'>No article ID supplied.</p>\n"; } else if(!$_POST['id']) { //include config file include "config.php"; $title = ($_POST['title']); $query = "SELECT title, author, text FROM news WHERE id=".$_GET['id']; $result = mysql_query($query) or die("Query failed: ".mysql_error()); if (mysql_num_rows($result) > 0) { // yes // print them one after another echo "<table cellpadding=10 border=1>"; while($row = mysql_fetch_assoc($result)) { // I like fetch_assoc better echo "<tr>"; echo "<td>".$row['title']."</a></td>"; echo "<td>".$row['author']."</td>"; echo "<td>".$row['text']."</td>"; echo "</tr>"; } echo "</table>"; } else { // no // print status message echo "No rows found!"; } // free result set memory mysql_free_result($result); // close connection mysql_close($connection); ?> <a href ="index.php">Home</a> </body> </html> As far as I can tell I have closed all the PHP lines so I can't figure out why it won't allow me to close the html Quote Link to comment Share on other sites More sharing options...
paul2463 Posted March 12, 2007 Share Posted March 12, 2007 you have missed a closing curly brace here // close connection mysql_close($connection); } //you need to put this in ?> Quote Link to comment Share on other sites More sharing options...
vbnullchar Posted March 12, 2007 Share Posted March 12, 2007 have you you check your config.php Quote Link to comment Share on other sites More sharing options...
DangerM0use Posted March 12, 2007 Author Share Posted March 12, 2007 Nope the config file is fine, works with other documents that are working fine. It was my error, shock horror, I just can't count! Cheers for pointing out the obvious mistake! Quote Link to comment 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.