Can anybody assist me to realise why this update query is not working? I've this during my php page to retrieve the present values in the database:

<?php

  $query = mysql_query ("SELECT * FROM blogEntry WHERE username = 'bobjones' ORDER BY id DESC");

  while ($row = mysql_fetch_array ($query)) 
  {
      $id = $row['id']; 
      $username = $row['username'];
      $title = $row['title'];
      $date = $row['date'];
      $category = $row['category'];
      $content = $row['content'];


    ?>

Here' my HTML Form:

<form method="post" action="editblogscript.php">
ID: <input type="text" name="id" value="<?php echo $id; ?>" /><br />
Username: <input type="text" name="username" value="<?php echo $_SESSION['username']; ?>" /><br />
Title: <input type="text" name="udtitle" value="<?php echo $title; ?>"/><br />
Date: <input type="text" name="date" value="<?php echo $date; ?>"/><br />
Message: <textarea name = "udcontent" cols="45" rows="5"><?php echo $content; ?></textarea><br />
<input type= "submit" name = "edit" value="Edit!">
</form>

here is my 'editblogscript':

<?php

mysql_connect ("localhost", "root", "");
mysql_select_db("blogass");

if (isset($_POST['edit'])) {

    $id = $_POST['id'];
    $udtitle = $_POST['udtitle'];
    $udcontent = $_POST['udcontent'];


    mysql_query("UPDATE blogEntry SET content = $udcontent, title = $udtitle WHERE id = $id");
}

header( 'Location: index.php' ) ;





?>

I do not realise why it does not work.

Not understanding exactly what the actual error you are receiving is I'd guess it's missing quotes. try the next:

mysql_query("UPDATE blogEntry SET content = '$udcontent', title = '$udtitle' WHERE id = '$id'")

First, you need to define "does not work".
Second, I suppose that the table area 'content' is varchar/text, so you have to enclose it in quotes. content = '{$content}'
And finally: use echo mysql_error() directly following a query to debug.

You need single quotes around any VARCHAR content inside your queries. So that your update query ought to be:

mysql_query("UPDATE blogEntry SET content = '$udcontent', title = '$udtitle' WHERE id = $id");

Also, it's bad form to improve your database directly using the content from the Publish. You need to sanitize your incoming data using the mysql_real_escape_string function.

Replace

mysql_query("UPDATE blogEntry SET content = $udcontent, title = $udtitle WHERE id = $id");

with

mysql_query("UPDATE blogEntry SET content = $udcontent, title = $udtitle WHERE id = $id") or die(mysql_error());

to ascertain if you've mysql errors. Most likely you'll have trouble with quotes.