1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
|
<?php require("configure.php");
$ProductCatId = $_GET["ProductCatId"]; $ProductColourId = $_GET["ProductColourId"]; $Sort = $_GET["Sort"]; print_r($_GET);
//Delete Child $sql = "SELECT ProductGrade.ProductGradeId FROM ProductGrade Where ProductCatId=". $ProductCatId ." "; $result1 = mysql_query($sql) or die(mysql_error()); while ($row1 = mysql_fetch_array($result1,MYSQL_ASSOC)) { $sql = "DELETE FROM Product WHERE ProductGradeId=". $row1{'ProductGradeId'} ." "; //echo "$sql <br><br>"; mysql_query($sql); if( mysql_errno() > 0 ){ echo 'Product Detail Delete Error:<br />'. mysql_error() .'<br />SQL: '. $sql; exit; } }
$sql = "DELETE FROM ProductGrade WHERE ProductCatId=". $ProductCatId ." "; //echo "$sql <br><br>"; mysql_query($sql); if( mysql_errno() > 0 ){ echo 'Product Detail Delete Error:<br />'. mysql_error() .'<br />SQL: '. $sql; exit; }
// Delete db $sql = "DELETE FROM ProductCat WHERE ProductCatId=". $ProductCatId ." ";
//echo $sql; mysql_query($sql); if( mysql_errno() > 0 ){ echo 'Product Category Delete Error:<br />'. mysql_error() .'<br />SQL: '. $sql; exit; }
mysql_query("UPDATE ProductCat SET Sort = Sort-1 WHERE ProductColourId = $ProductColourId AND Sort >= $Sort "); mysql_close($dbh);
header("Location: productcat_index.php?msg=Delete Successful");
?>
|