<?php 
include_once('IsLogined.php');
$class   = $_GET['class'];
$ID      = $_POST['ID'];
$Qname   = $_POST["name"];
$Qprice  = $_POST['price'];
$Qinfo   = $_POST['info'];
if(empty($class)){
	echo("<script language=javascript>alert('参数传递不正确!');window.history.go(-1);</script>");
	exit();
}
if(empty($Qname) || empty($Qprice)){
	echo("<script language=javascript>alert('填写不完整!');window.history.go(-1);</script>");
	exit();
}
include_once("../config/databaseConfig.inc.php");
$sql = "SELECT * FROM {$class} WHERE ID = {$ID}"; 
# 从数据库中查询出资料集
$rs = $db->Execute($sql); # 执行查询，并取得一个空的资料集
$record = array(); # 初始化一个数组，以便存放记录资料供新增用
# 设定记录中的字段值
$record["name"]   = $Qname;
$record["price"]  = $Qprice;
$record["info"]   = $Qinfo;
$updateSQL = $db->GetUpdateSQL($rs, $record, false ,true);
$db->Execute($updateSQL); 
$rs->close();
$db->close();
echo("<script language=javascript>alert('修改成功!');window.location = 'ListCpt.php?class={$class}' </script>");
exit;
?>