⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 deletecategory.php

📁 《PHP专业项目实例开发》源代码
💻 PHP
字号:
<html>
<head>
<title>Delete Category      </title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>

<body bgcolor="#FFFFFF" text="#000000">
<?php
 if(!isset($categoryid)) {  die("category ID not submitted !"); } if(empty($categoryid)) {  die("category ID empty !"); } if($categoryid<2) {  die("Sorry this category cant be deleted !"); }   $host=""; $username="root"; $password=""; $database="books";  $x=mysql_connect($host,$username,$password);
 $x1=mysql_select_db($database);
 $query="select parentcategoryid from category where categoryid ='".$categoryid."'";
   $result=mysql_query($query); {  if($row=mysql_fetch_array($result))   {    $parentcategoryid=$row["parentcategoryid"];       }   else   {    die("Parent Not Found!!!");   } } $query="select * from category where parentcategoryid ='".$categoryid."'";
   $result=mysql_query($query); while($row=mysql_fetch_row($result)) {   $query2="Update category SET parentcategoryid='".$parentcategoryid."' where parentcategoryid='".$categoryid."'";    $result2=mysql_query($query2);   if(!$result2)    {      die("Tree shift failed !! <br>");    }   else   {    echo "Successfully shifted tree<br>";   } }   $query="delete from category where categoryid ='".$categoryid."'";
 $result=mysql_query($query); if($result) {   echo "category record deleted from categorys table.<br>\n"; } else {  echo "category record wasnt in categorys table !<br>\n"; }?>
<br><br>To return to Admin page <A href="index.htm"> Click here! </a><br><br></body>
</html>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -