Jump to content

[SOLVED] Can't figure out why I am getting an error


DangerM0use

Recommended Posts

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

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.