<?php
include("connection.php");
$id=$_GET['id'];
session_start();
$name=$_SESSION['username'];
$author=mysql_real_escape_string($_POST['author']);
$title=mysql_real_escape_string($_POST['title']);
$content=mysql_real_escape_string($_POST['content']);
$query=mysql_query("UPDATE blogs SET title='$title' WHERE id='$id'") or die(mysql_error());
$query=mysql_query("UPDATE blogs SET content='$content' WHERE id='$id'") or die(mysql_error());
$query=mysql_query("UPDATE blogs SET author='$author' WHERE id='$id'") or die(mysql_error());
if($query){
header("location:view_blog.php?updated");
exit(0);
}
else
{
header("location:edit_blog.php?error");
exit(0);
}
?>