产品叠加搜索

  1 <?include "top.php";?>
  2 
  3 <table width="100%"  border="0" cellspacing="0" cellpadding="0"  style="background: url(../images/products_1.jpg) no-repeat center top;">
  4   <tr>
  5     <td><table width="1002" border="0" cellspacing="0" cellpadding="0" align="center">
  6   <tr>
  7     <td><img src="../images/products_6.jpg" width="1002" height="214" border="0" /></td>
  8   </tr>
  9 </table>
 10 </td>
 11   </tr>
 12 </table>
 13 
 14 
 15 <!--左-->    
 16 <table width="1002" border="0" cellspacing="0" cellpadding="0" align="center">
 17   <tr>
 18     <?include "left_pro_d.php";?>
 19     
 20 
 21 <!--右-->    
 22     <td width="74%" valign="top"><div class="in1">&nbsp;</div>
 23     
 24     <table width="100%"  border="0" cellspacing="0" cellpadding="0">
 25   <tr>
 26     <td height="31" background="../images/produ_1.jpg" valign="top"><table width="95%"  border="0" align="right" cellpadding="0" cellspacing="0">
 27       <tr>
 28         <td class="pz12j" align="left"> <strong>产品分类</strong>
 29         
 30         </td>
 31       </tr>
 32     </table></td>
 33   </tr>
 34   <tr>
 35     <td><table width="100%"  border="0" cellspacing="0" cellpadding="0">
 36       <tr>
 37         <td valign="top" width="37" background="../images/pro_15.jpg"></td>
 38         <td><table width="100%"  border="0" cellspacing="0" cellpadding="0">
 39         
 40 
 41         
 42             <?
 43                 $querytype="select ncid,ncname from productstype where nt=1  order by norder asc ";
 44                 $rstype=mysql_query($querytype, $dbh);
 45                 $numtype=mysql_num_rows($rstype);
 46                 $number=$numtype;
 47             ?>
 48             
 49             
 50             <?
 51 //获取参数
 52     for($x=1;$x<$number+1;$x++){
 53     if($_REQUEST["ncid".$x]!=""&&$_REQUEST["nrid".$x]!=""){
 54         //echo "ncid".$x.":".$_REQUEST["ncid".$x];//大类
 55         //echo "nrid".$x.":".$_REQUEST["nrid".$x]; //小类
 56         if($x<$number+1){
 57         $str2=$str2."ncid".$x."=".$_REQUEST["ncid".$x]."&nrid".$x."=".$_REQUEST["nrid".$x]."&";
 58         }
 59         $str=$str." and nid in ( select nid from protab where nrid=".$_REQUEST["nrid".$x].")";
 60     }
 61 }
 62 
 63 //产品类别列表
 64 for($i=0;$i<$number;$i++){
 65     $rowt=mysql_fetch_array($rstype);
 66     $tyid=$rowt[ncid];
 67     //echo "<br>&nbsp; &nbsp; &nbsp;".$rowt[ncname].":  ";
 68     ?>
 69     <tr>
 70       <td><table width="90%"  border="0" align="right" cellpadding="0" cellspacing="0">  
 71         <tr>
 72            <td width="8%" class="pz12k"><?=$rowt[ncname]?>:</td>
 73            <td width="92%" align="left">
 74     <?
 75     
 76     $querytype2="select ncid,ncname from productstype where nt=2 and rid=".$tyid." order by norder asc";
 77     //echo $querytype2;
 78     $rstype2=mysql_query($querytype2, $dbh);
 79     $numtype2=mysql_num_rows($rstype2);
 80     if (!empty($numtype2)){
 81     for($k=0;$k<$numtype2;$k++){
 82         $rowt2=mysql_fetch_array($rstype2);
 83         ?> 
 84         &nbsp;<a href="pro2.php?<?=$str2?>&ncid<?=$i+1?>=<?=$tyid?>&nrid<?=$i+1?>=<?=$rowt2[ncid]?>#a"  class="a07"><?=$rowt2[ncname]?></a>    &nbsp;    
 85         <?
 86     }
 87     ?>
 88     </td>
 89      </tr>  
 90         </table></td>
 91             </tr>
 92          
 93           <tr>
 94             <td><img src="../images/produ_2.jpg" width="708" height="8" /></td>
 95           </tr>
 96 
 97     <?
 98     }
 99 }
100 ?>          
101                     
102           <tr>
103            <td align="left" style="color:#FF7F50"><br>
104             &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
105            <a href="pro2.php#a" class="a071"><strong>重新选择<strong></a>&nbsp;&nbsp;
106                       <?
107         $querytype="select ncid,ncname from productstype where nt=1  order by norder asc ";
108         $rstype=mysql_query($querytype, $dbh);
109         $numtype=mysql_num_rows($rstype);
110         $number=$numtype;
111         for($x=1;$x<$number+1;$x++){
112             if($_REQUEST["ncid".$x]!=""&&$_REQUEST["nrid".$x]!=""){
113             $querytype4="select ncid,ncname from productstype where nt=2 and ncid=".$_REQUEST["nrid".$x];
114             //echo $querytype4;
115             $rstype4=mysql_query($querytype4, $dbh);
116             $numtype4=mysql_num_rows($rstype4);
117             if (!empty($numtype4)){
118             $rowt4=mysql_fetch_array($rstype4);
119             echo $rowt4[ncname]."  ";
120         }
121         }
122         }
123     ?>
124            &nbsp;&nbsp;
125            
126            </td>   
127           </tr>
128              
129             <tr>
130            <td align="left">&nbsp;</td>   
131           </tr>
132           
133              
134         </table></td>
135       </tr>
136     </table></td>
137   </tr>
138 </table>
139 
140 
141 
142     
143     <table width="100%" border="0" cellspacing="0" cellpadding="0">
144       <tr>
145         <td background="../images/pro_14.jpg" height="53" valign="top" >
146         <table width="691" border="0" cellspacing="2" cellpadding="0" align="right">
147           <tr>
148             <td class="pz12b" align="left">&nbsp;<strong>产品展示</strong></td>
149             <td align="right" class="pz12b">当前位置:首页 - 产品展示&nbsp;&nbsp;</td>
150           </tr>
151         </table></td>
152       </tr>
153       <tr>
154         <td>
155         
156         <table width="100%" class="pro"  border="0" cellspacing="0" cellpadding="0">
157           
158           <tr>
159             <td valign="top" width="37" background="../images/pro_15.jpg"></td>
160            
161             <td valign="top">
162             <table width="99%"  border="0" cellspacing="0" cellpadding="0" align="center">
163             <tr>
164     
165 <?//-------------------------------------------------?>
166             <td valign="top">
167 
168             <ul style="100%">
169             <?            
170                 $limit=6;
171                 $start=0;
172                 $pageno=1;
173                 $pagename="pro2.php";
174            
175                 if ($_REQUEST["pageno"]!=0){
176                     $pageno=$_REQUEST["pageno"];
177                     if ($pageno>1){
178                         $start=($pageno-1)*$limit;
179                     }
180                 }
181 
182                 
183                 
184         //搜索产品列表
185         $que6="select nid,other,npic2 from products where 1=1 ".$str;
186         //echo $que6."<hr>";
187         $rs6=mysql_query($que6, $dbh);
188         $num6=mysql_num_rows($rs6);
189 
190                 $totalpage=intval($num6/$limit);
191 
192                 if ($num6%$limit>0){
193                     $totalpage=$totalpage+1;
194                 }
195 
196                 if ($pageno>$totalpage){
197                     $pageno=$totalpage;
198                     if ($pageno>1){
199                         $start=($pageno-1)*$limit;
200                     }
201                 }
202 
203                 $result=mysql_query($que6." order by nid desc limit $start,$limit", $dbh);
204                 //echo $query." order by nid limit ".$start.",".$limit;
205 
206                 $numb=mysql_num_rows($result);
207                 
208                 
209                     if (!empty($numb)){
210                     for($b=0;$b<$numb;$b++){
211                         $row6=mysql_fetch_array($result);
212                         
213                         $nid=$row6[nid];
214                         $other=$row6[other];
215                         $npic2=$row6[npic2];
216                         
217                     ?>
218                     
219                         <li style="margin-right:0px;">
220                         
221                         <table width="163" height="163"  border="0" cellpadding="0" cellspacing="0">
222                           <tr>
223                             <td width="150" height="150">
224                             <a href="pro_d.php?nid=<?=$nid?>&cid=<?=$cid?>#a"><img src="<?=$npic2?>" /></a></td>
225                             <td width="13" background="../images/y_2.jpg">&nbsp;</td>
226                           </tr>
227                           <tr>
228                             <td height="13" background="../images/y_4.jpg">&nbsp;</td>
229                             <td valign="top"><img src="../images/y_6.jpg" width="13" height="13"></td>
230                         </tr>
231                         
232                         <tr><td>
233                                 <div align="center" class="p12c"><?=$other?></div>
234                             </td></tr>
235                         </table>        
236                         
237                         </li>
238                     <?}?>    
239                     </ul>
240                 </td>
241         </tr>
242         <tr><td align="center" ><div>
243             <form action="<?echo $pagename?>" method="get">
244                 <span class="p12b"><a href="<?echo $pagename?>?pageno=0#a" class="a01">第一页</a> 
245                 <a href="<?echo $pagename?>?pageno=<?echo $pageno-1?>#a" class="a01">上一页</a> 
246                     <?if($totalpage==1){?>
247                 <a href="<?echo $pagename?>?pageno=<?echo $pageno?>#a" class="a01">下一页</a> 
248                 <?}else{?>
249                 <a href="<?echo $pagename?>?pageno=<?echo $pageno+1?>#a" class="a01">下一页</a> 
250                 <?}?>    
251                 <a href="<?echo $pagename?>?pageno=<?echo $totalpage?>#a" class="a01">最后页</a>
252                  第:<input name="pageno" type="text" size="2" />
253                 当前页数:第<?echo $pageno?>页 / 共<?echo $totalpage?>页</span>
254             </form>
255             </div></td></tr>
256             
257             <?        
258         }else{
259         ?>
260             <tr>
261                 <td align="left" class="pz12a"><a class="a01">暂时没有资料!</a></td>
262             </tr>              
263           <?
264             }              
265           ?>
266         <tr>
267             <td>&nbsp;</td>
268           </tr>
269         </table>
270 
271         </td>
272 <?//-------------------------------------------------?>
273 
274 
275 
276             </tr>
277             </table>
278             </td>
279 
280       </tr>
281 </table>
282         
283         
284     </td>
285   </tr>
286     </table></td>
287   </tr>
288 </table>
289 
290 <!--末-->
291 <?include "bottom.php";?>
HLb`s签名:给自己一个拼搏的理由,好好的坚持下去。
原文地址:https://www.cnblogs.com/huanglibin/p/3195890.html