<?php
include_once('conn.php');
include_once('smarty.php');
  if(!isset($_GET['newsId'])||$_GET['newsId']==null){
  	echo "<script>alert(来源错误，必须有新闻id才能处理！);history:back();</script>";
  	exit;
  }else{
  	$newsId=$_GET['newsId'];
  	$sql="select * from news where newsId=$newsId";
  	$sql1="select * from cat ";
  	$result1=mysql_query($sql1,$conn);
  	while ($array=mysql_fetch_array($result1,MYSQL_ASSOC)) {
  		$row[]=$array;
  	}
  	$smarty->assign('row',$row);
  	if($result=mysql_query($sql,$conn)){
  		while ($row1=mysql_fetch_array($result,MYSQL_ASSOC)) {
  		$edit[]=$row1;
  		}
  		$smarty->assign('edit1',$edit);
  		$smarty->display('editNews.html');
  	}
  }
?>