<?php
include "../conn.php";

$id = $_GET["id"];
//echo "<hr>$id<hr>";

if (isset($id))
{
	$title = "news detail";
	$header = "news detail";
	
	include "header.php";
	
	$query = "select date, subject, author, summary, body, url, img, highlight from news where id='$id'";
	//echo $query;
	
	$result = mysql_query($query);
	
	$row = mysql_fetch_array($result);
	
	$date = $row[0];
	$subject = $row[1];
	$author = $row[2];
	$summary = $row[3];
	$body = $row[4];
	$url = $row[5];
	$img = $row[6];
	$highlight = $row[7];
	
	?>
	<h2 align="center"><?php echo $subject ?></h2>
	<?php echo "$date&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;$author" ?>
	<p>
	<?php echo "$summary" ?>
	<br>
	<?php echo $body ?>
	<p>
	<?php 
	$file = @fopen ($url, "r");
	if ($file) 
	{
		echo "<a href=$url>more details about this news</a>"; 
	}
	
	?>
	<p>
	<?php
	$file = @fopen ($img, "r");
	if ($file)
	{ 
		echo "related image:<br>";
		echo "<img src=$img>";
	}
	include "footer.php";
}
else
{
	header("location: view.php");
}


?>