Esempio n. 1
0
     $result = mysql_query($insertSql);
     echo "<script>alert('修改成功!');window.parent.leftFrame.window.location.reload();window.location='../menu/menu.php?id=" . $id . "'</script>";
 } else {
     if ($type == "delete") {
         $sql = "select * from menu where pid = {$id}";
         $result = mysql_query($sql);
         if (mysql_num_rows($result) > 0) {
             echo "<script>alert('该目录下还有子目录,不能进行删除操作!');window.location='{$link}?id={$id}'</script>";
             return false;
         }
         deleteTableById($tablename, $id);
         echo "<script>alert('删除成功!');window.parent.leftFrame.window.location.reload();window.location='{$link}?id={$pid}'</script>";
     } else {
         if ($type == "setmenu") {
             if ($id) {
                 deleteTableById("menuset", $id);
             }
             $imageCount = 1;
             $textCount = 1;
             $dateCount = 1;
             $clobCount = 1;
             $fileCount = 1;
             $mediaCount = 1;
             $sort = $_POST["sort"];
             $title = $_POST["title"];
             $col_type = $_POST["col_type"];
             $isIndex = $_POST["isIndex"];
             while (list($key, $row) = each($title)) {
                 switch ($col_type[$key]) {
                     case "P":
                         $col_name = "text" . $textCount++;
Esempio n. 2
0
     $result = mysql_query(str_replace("#tablename#", $tablename, $tableRowSql));
     $i = 0;
     while ($row = mysql_fetch_object($result)) {
         $insertSql = $insertSql . ($i == 0 ? "" : ",") . $row->columnname . " = " . ($_POST[$row->columnname] == null ? "null" : "'" . $_POST[$row->columnname] . "'");
         $i++;
     }
     $insertSql = $insertSql . " where id ={$id}";
     //print $insertSql;
     $result = mysql_query($insertSql);
     if (!$result) {
         throw new Exception("错误!,sql为:{$insertSql}");
     }
     echo "<script>alert('修改成功!');window.location='{$link}" . (substr_count($link, "?") == 0 ? "?" : "&") . "pageNo={$pageNo}'</script>";
 } else {
     if ($type == "delete") {
         deleteTableById($tablename, $id);
         echo "<script>alert('删除成功!');window.location='{$link}" . (substr_count($link, "?") == 0 ? "?" : "&") . "pageNo={$pageNo}'</script>";
     } else {
         if ($type == "ajax") {
             $sql = stripcslashes($_REQUEST["sql"]);
             $result = mysql_query($sql);
             if (!$result) {
                 throw new Exception("错误!,sql为:{$sql}");
             }
             $returnList = array();
             while ($row = mysql_fetch_object($result)) {
                 array_push($returnList, $row);
             }
             echo json_encode(object_decode($returnList));
         }
     }