Hi,

I have these two scripts. Basically the first one prints out a list of blog titles with a link through to another page which will enable the user to edit the blog post. The first script is here and works fine:

PHP Code:
<?php include ('header.inc');
?>
<ul>
    

<?php
require_once ('mysql_connect.php');

  
$sql "SELECT * FROM entries ORDER BY date_submitted";
  
$sqlresult mysql_query($sql);
  while (
$row mysql_fetch_array($sqlresult)){
?>


 <li><a class="body" href="editentry.php?blog_id=<?php echo $row['blog_id']; ?>"><?php echo $row['title']; ?></a></li>
 <?php 
  
}

 include (
'footer.inc');
?>
</ul>
Now the second script is using the GET variable at the top of the page to find out which blog we're editing. I cant spot a problem with the code but i get this error:

[18-Jun-2006 22:40:55] PHP Parse error: syntax error, unexpected $end in /Applications/MAMP/htdocs/editentry.php on line 76

Anyways heres the code. Im new to php but have spent hours trying to debug to no avail. Perhaps my method of using the id in the url and using GET to, well get the id is not the correct method

PHP Code:
<?php 
include ('header.inc');

if(isset(
$_GET['blog_id'])) {
  
$blog_id $_GET['blog_id'];
}
else { 
  
$blog_id NULL;
  echo 
'Please specify a section';
}

  
  
$sql "SELECT * FROM entries WHERE blog_id = $blog_id";
  
$result mysql_query($sql);
  
$row mysql_fetch_array($result);
  while(
$row) {
  
$title $row['title'];
  
$body $row['body'];


?>
<div id="main">
    


<form action="<?php echo $_SERVER['PHP_SELF']; ?>?blog_id=<?php echo $blog_id?>" name="input" method="post">
                     <input type="text" size="50" name="title" maxlength="200" value="<?php echo $title?>" />
                     <input type="text" size="50" name="body" maxlength="200" value="<?php echo $body?>"/>
                     <input class="bodyform" type="submit" name="submitedit" value="SUBMIT"/>
</form>

<?php
  
}
  
?>
  <?php

if (isset($_POST['submitedit'])) {
//form validation

if (strlen($_POST ['title']) > 0) {
         
$title $_POST ['title'];
       }
    else { 
        
$title NULL;
    }
       
    if (
strlen($_POST['body']) > 0) {
         
$body $_POST['body'];
       }
    else { 
        
$body NULL;
       }
if(
$title && $body) {
    
//update the database with edited data
    
$sql "UPDATE entries SET title = $title, body = $body WHERE blog_id = $blog_id";
  
$result mysql_query($sql);

 
}


else { echo 
'please fill out form fields';
}


include (
'footer.inc');
?>
any ideas?!?