Execute($sql); if (!$rs || $rs->EOF){ die("查询数据库出错!"); } $o_id = $rs->fields("id"); $o_pId = $rs->fields("pId"); $o_name = $rs->fields("name"); $o_addDate = $rs->fields("addDate"); $o_company = $rs->fields("company"); $o_person = $rs->fields("person"); $o_tele = $rs->fields("tele"); $o_email = $rs->fields("email"); $o_address = $rs->fields("address"); $o_model1 = $rs->fields("model1"); $o_num1 = $rs->fields("num1"); $o_content = $rs->fields("content"); $rs->Close(); //取得POST数据 //把要删除旧文件存到数组中 $fileToDel = array(); //取得POST数据 $fileSaved = array();//已保存文件名数组 /** *编号 */ $i_id = $_POST["i_id"]; if (false === checkInt($i_id)) { goback("请规范操作!"); exit(); } /** *所属分类 */ $i_pId = 0; /** *标题 */ $i_name = $_POST["i_name"]; if (trim($i_name) == "") { goback("标题不能为空!"); exit(); } $i_name = GBsubstr($i_name , 0 , 50); /** *添加时间 */ $i_addDate = date("Y-m-d H:i:s"); /** *公司 */ $i_company = $_POST["i_company"]; $i_company = GBsubstr($i_company , 0 , 50); /** *联系人 */ $i_person = $_POST["i_person"]; $i_person = GBsubstr($i_person , 0 , 50); /** *电话 */ $i_tele = $_POST["i_tele"]; $i_tele = GBsubstr($i_tele , 0 , 50); /** *E-Mail */ $i_email = $_POST["i_email"]; $i_email = GBsubstr($i_email , 0 , 50); /** *地址 */ $i_address = $_POST["i_address"]; $i_address = GBsubstr($i_address , 0 , 50); /** *型号 */ $i_model1 = $_POST["i_model1"]; $i_model1 = GBsubstr($i_model1 , 0 , 50); /** *数量 */ $i_num1 = $_POST["i_num1"]; $i_num1 = GBsubstr($i_num1 , 0 , 50); /** *留言内容 */ $i_content = $_POST["i_content"]; //保存数据 $sql = "update `page2Content1` set `pId` = " . $conn->qstr($i_pId) . ",`name` = " . $conn->qstr($i_name) . ",`addDate` = " . $conn->qstr($i_addDate) . ",`company` = " . $conn->qstr($i_company) . ",`person` = " . $conn->qstr($i_person) . ",`tele` = " . $conn->qstr($i_tele) . ",`email` = " . $conn->qstr($i_email) . ",`address` = " . $conn->qstr($i_address) . ",`model1` = " . $conn->qstr($i_model1) . ",`num1` = " . $conn->qstr($i_num1) . ",`content` = " . $conn->qstr($i_content) . " where `id` = " . $conn->qstr($i_id); $rs = &$conn->Execute($sql); if (false === $rs) { foreach($fileSaved as $fileSavedName) {//删除已经上传的文件 if (trim($fileSavedName) != "" && file_exists($LT["inc"]["dbimagesRoot"] . "/page2/" . $fileSavedName))@unlink($LT["inc"]["dbimagesRoot"]. "/page2/" .$fileSavedName); }//end foreach goback("保存数据时出错!"); exit(); }//if结束 //删除旧文件 foreach ($fileToDel as $delFileName) { if (trim($delFileName) != "" && file_exists($LT["inc"]["dbimagesRoot"] . "/page2/" . $delFileName)) { @unlink($LT["inc"]["dbimagesRoot"] . "/page2/" . $delFileName); } } $resultMsg = "数据已经成功保存!"; $conn->Close(); echo ""; exit(); /** * 显示信息返回 */ function goback($show_infor) { echo ""; }//function goback结束 ?>