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
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
|
<?php require("configure.php"); $page = $_GET['page']; $productcatid =(int)$_GET['productcatid']; $offset = $_GET["offset"]; $where = $_GET["where"]; ?> <!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"> <html> <head> <title>Stand Raise Limited</title> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> <link rel="stylesheet" type="text/css" href="../css/style.css" /> <script language="javascript"><!-- function popupWindow(url) { window.open(url,'popupWindow','toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=0,width=720,height=700,screenX=100,screenY=100,top=50,left=50') } //--></script> </head> <body bgcolor="#CCCCCC" leftmargin="0" topmargin="0" style="background-repeat:repeat-x" background="../images/main_bg.jpg"> <table width="900" border="0" align="center" cellpadding="0" cellspacing="0"> <tr> <!-- Header --> <?php require("header.php"); ?> </tr> <tr> <td height="52" align="center" valign="top"> <!-- Menu --> <?php require("menu.php"); ?></td> </tr> <tr> <td align="left" valign="top" bgcolor="#FFFFFF"><table width="900" height="500" border="0" cellpadding="0" cellspacing="0"> <tr><td width="215" align="left" valign="top" bgcolor="#E6E7E9"><img src="../images/menutop.jpg" /> <!-- Sub Menu --> <?php require("submenu.php"); ?> </td> <td width="685" align="left" valign="top"><div class="colMiddle"><table border="0" cellpadding="0" cellspacing="0"> <tr> <td width="655"><table width="655" border="0" cellpadding="0" cellspacing="0"> <tr> <td class="title"> <? $sql = "SELECT * "; $sql .= "FROM productcat "; $sql .= "where productcatid = $productcatid "; $result = mysql_query($sql); $row = mysql_fetch_array($result,MYSQL_ASSOC); if ($productcatid == "") { echo "Product"; }else{ echo $row{'productcatname'}; } ?></td> </tr> <tr> <td class="txt"><div class="colcontenttxt"> <table border="0" cellpadding="0" cellspacing="0">
<? $limit=9; if (!$offset) $offset=0;
if (strlen($where)==0) { if (strlen($productcatid)<>0) { $query_where .= "and productimage.productcatid = ". $productcatid ." "; } } else { $query_where = $where; } if (!$where) { if (empty($one) || empty($two)) { } $where=$query_where; } $sqlx = "select count(*) "; $sqlx .= "FROM productimage inner join productcat "; $sqlx .= "on productimage.productcatid = productcat.productcatid "; $sqlx .= "$query_where "; $sqlx = str_replace('\\','',$sqlx); $result=mysql_query($sqlx);
list($numrec)=mysql_fetch_row($result);
$numpage=intval($numrec/$limit);
if ($numrec%$limit) { $numpage++; // add one page if remainder } ?> <!--start here--> <? if ($productcatid == '') { $sortby = 0; $sql_cat = " delete from tmpproduct"; mysql_query($sql_cat); $sql_cat = " select * from productcat"; $sql_cat .= " where parentid = 0"; $sql_cat .= " order by parentid, sortby"; // echo $sql_cat."<br>"; $res_cat = mysql_query($sql_cat); if (mysql_num_rows($res_cat) > 0) { while ($row_cat = mysql_fetch_array($res_cat)) { $sql_img = " select * from productcat c, productimage i"; $sql_img .= " where (1=1)"; $sql_img .= " and c.productcatid = i.productcatid"; $sql_img .= " and (c.parentid = ".$row_cat["productcatid"]; $sql_img .= " or c.productcatid =".$row_cat["productcatid"].")"; $sql_img .= " order by parentid, sortby, sortbyimage"; // echo $sql_img."<br>"; $res_img = mysql_query($sql_img); if (mysql_num_rows($res_img) > 0) { while ($row_img = mysql_fetch_array($res_img)) { $catid = $row_img["productcatid"]; $name = $row_img["productname"]; $image = $row_img["image"]; $productimageid = $row_img["productimageid"]; $sortby ++; $sql_ins = " insert into tmpproduct"; $sql_ins .= " (productcatid, productname, image, sortby, productimageid)"; $sql_ins .= " values ('$catid', '$name', '$image', '$sortby', '$productimageid')"; // echo $sql_ins."<br>"; mysql_query($sql_ins); } } } } $sqly = " select * from tmpproduct order by sortby"; $sqly .= " limit $offset,$limit"; //echo $sqly; } else { $sqly = "SELECT * "; $sqly .= "FROM productimage inner join productcat "; $sqly .= "on productimage.productcatid = productcat.productcatid "; $sqly .= "$query_where "; $sqly .= "order by productcat.parentid ASC, productcat.sortby, productimage.sortbyimage "; $sqly .= "limit $offset,$limit"; } $x = 1; $y = 1;
echo "<tr>"; $result1 = mysql_query($sqly);
while ($row = mysql_fetch_array($result1,MYSQL_ASSOC)) { $bgcolor="#FFFFFF"; if ($y == 1) { } elseif ($y == 4) echo "<tr>"; elseif ($y == 7) echo "<tr>"; /*elseif ($y == 10) echo "<tr>";*/ ?> <td valign="top"> <table width="215" border="0" cellpadding="0" cellspacing="0"> <tr> <td width="210" align="left" valign="top"> <a href="javascript:popupWindow('pop_product.php?productimageid=<?=$row{'productimageid'}?>')"><img src="..\admin\smallproduct\<?=$row{'image'}?>" border='0' width='200'></a></td> </tr> <tr> <td width="210" height="40" valign="top" class="txt"> <a href="javascript:popupWindow('pop_product.php?productimageid=<?=$row{'productimageid'}?>')"><?=$row{'productname'}?></a></td> </tr> </table> </td> <? if ($y == 3) echo "</tr>"; elseif ($y == 6) echo "</tr>"; elseif ($y == 9) echo "</tr>"; /*elseif ($y == 12) echo "</tr>";*/ $y = $y + 1; } ?> <!--end here--> </table><? include("pagenav.php"); ?> </div></td> </tr> </table></td> </tr> </table> </div></td> </tr> </table></td> </tr>
<!-- Footer --> <?php require("footer.php"); ?> </table> </body>
</html>
|