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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
|
<?php $rowPerPage=20; if((!$_GET['page'])||($_GET['page']==1)){ $_GET['page']=1; $startRow=0; }else{ $startRow=($_GET['page']-1)*$rowPerPage; } #################################################### if($_POST['action']=='ChStatus'){ $query="UPDATE tbl_product_data SET is_example ='".$_POST['changeValue']."' WHERE id= '".$_POST['ids']."' "; //echo $query; mysql_query($query); } #################################################### if($_POST['action']=='Delete'){ @unlink($path_product.$_POST['image_name']); @unlink($path_product."/thb/".$_POST['image_name']); $query="SELECT * FROM `tbl_product_img` WHERE product_ID= '".$_POST['ids']."' "; $resultIMG=mysql_query($query); while($data=mysql_fetch_assoc($resultIMG)){ @unlink($path_product.$data['file_name']); @unlink($path_product."/thb/".$data['file_name']); } $query="DELETE FROM tbl_product_img WHERE product_ID= '".$_POST['ids']."' "; mysql_query($query); $query="DELETE FROM tbl_product_data WHERE id= '".$_POST['ids']."' "; mysql_query($query); } #################################################### $query="SELECT * FROM tbl_product_data WHERE mainCateId='".$_GET['ManCateID']."' ORDER BY id DESC "; $queryLimit=$query." LIMIT $startRow , $rowPerPage "; $result=mysql_query($queryLimit); $resultBrowse2=mysql_query($query); $xrow=mysql_num_rows($resultBrowse2); $totalPage=ceil($xrow/$rowPerPage);
?><!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>Untitled Document</title> <link href="style.css" rel="stylesheet" type="text/css" /> <script language="javascript"> function DeleteThis(ids, image_name){ if(confirm('ต้องการลบรายการนี้ ?')){ document.form1.action.value='Delete'; document.form1.ids.value=ids; document.form1.image_name.value=image_name; document.form1.submit(); }else{ return false; } } //------------------------------------------------------- function changeStatus(ids, theValue){ if(theValue=='1'){ document.form1.changeValue.value=0; }else if(theValue=='0'){ document.form1.changeValue.value=1; } document.form1.ids.value=ids; document.form1.action.value='ChStatus'; document.form1.submit(); } </script> </head>
<body><form action="<?php $_SERVER['PHP_SELF']?>" method="post" name="form1" enctype="multipart/form-data"> <table width="99%" border="0" align="center" cellpadding="2" cellspacing="2"> <tr class="red"> <td width="4%" height="25" align="center" bgcolor="#D9D9B3"><img src="images/black_icon/16x16/app_window.png" width="16" height="16" /></td> <td width="96%" bgcolor="#D9D9B3">รายชื่อสินค้า ในหมวด <input name="action" type="hidden"/> <input name="ids" type="hidden"/> <input name="image_name" type="hidden" /> <input name="changeValue" type="hidden" /> </td> </tr> <tr> <td colspan="2"> </td> </tr> <tr> <td colspan="2" class="txt10-black"><table width="100%" border="0" cellspacing="1" cellpadding="0"> <tr> <td height="25" bgcolor="#E0E0E0"> </td> <td align="center" bgcolor="#E0E0E0" class="txt10-black">ชื่อสินค้า</td> <td width="8%" align="center" bgcolor="#E0E0E0" class="txt10-black"><!--ตัวอย่างสินค้า --> แก้ไข</td> <td align="center" bgcolor="#E0E0E0" class="txt10-black">ลบ</td> </tr> <?php while($data=mysql_fetch_assoc($result)){ ?> <tr> <td width="4%" height="25" align="center" bgcolor="#EBEBEB"><img src="images/black_icon/16x16/box.png" width="16" height="16" /></td> <td width="80%" bgcolor="#EBEBEB" class="txt10-black"> <?php echo $data['product_name_th']?></td> <td align="center" bgcolor="#EBEBEB" class="txt10-black"><!--<input type="checkbox" name="checkbox[]" id="checkbox[]" <?php if($data['is_example']==1){ echo "checked";}?> onclick="changeStatus('<?php echo $data['id']?>' , '<?php echo $data['is_example']?>')" /> --> <a href="main.php?work=AddProduct&currID=<?php echo $data['id']?>" title="แก้ไข <?php echo $data['cate_name']?>"> <img src="images/black_icon/16x16/doc_edit.png" width="16" height="16" border="0" /></a> </td> <td width="8%" align="center" bgcolor="#EBEBEB"> <a href="#" title="ลบ <?php echo $data['product_name_th']?>" onClick="DeleteThis('<?php echo $data['id']?>','<?php echo $data['product_image']?>')"><img src="images/black_icon/16x16/sq_minus.png" width="16" height="16" border="0" /></a> </td> </tr> <?php } ?> </table></td> </tr> <tr> <td colspan="2"> </td> </tr> </table> </form> </body> </html>
|