<%
set rs=server.createobject("ADODB.Recordset")
sql="select * from P_info where p_other = 0 "
classType = request("classType")
smallclass = request("smallclass")
key = request("key")
if classType <> "" then
	sql = sql & " and p_type = '"&classType&"'"
end if
if smallclass <> "" then
	sql = sql & " and p_small_type = '"&smallclass&"'"
end if
if key <> "" then
	sql = sql & " and (p_name like '%"&key&"%' or  p_spec like '%"&key&"%') "
end if

sql = sql & " order by p_id desc"
rs.open sql,conn,1,1

if not isempty(request("page")) then   
pagecount=cint(request("page"))   
else   
pagecount=1
end if

%>                                        <table width="98%" border="0" cellpadding="0" cellspacing="0">
     
                                                    
        <tr> 
          <td align="left" valign="top"> <table width="98%" border="0" cellpadding="0" cellspacing="0" >
              <%
						sql_type="select * from P_class_small where p_type = '" & classType & "' order by p_small_id desc"
						set rs_type=server.createobject("adodb.recordset")
						rs_type.open sql_type,conn,1,3
					%>
              <tr> 
                <%
					if rs_type.eof and rs_type.bof then 
					 else
							for i=1 to rs_type.recordcount
							 if rs_type.EOF then exit for 
					%>
                <% if i mod 4 = 0 then %>
              </tr>
              <tr> 
                <%end if%>
                <%
						 rs_type.movenext
						 next
						 end if 
						 rs_type.close
					 %>
            </table>
                                                        <table width="100%" border="0" cellpadding="0" cellspacing="0" >
                                                          <%
					if rs.eof or rs.bof then
					  response.write("对不起没有你查询的记录")
					 else
						rs.pagesize=20
				%>

                                                          <tr>
                                                            <%
						rs.AbsolutePage=pagecount

						for i=1 to rs.recordcount
							if rs.EOF then exit for 
					%>
                                                            <td align="center" ><table width="25%" border="0" cellspacing="0" cellpadding="0">
                                                                <tr>
                                                                  <td  align="center" valign="top"><a href="showProDetail.asp?ProID=<%=rs("p_id")%>"><img src="<%=rs("p_pic")%>" width="70" height="60" border="0"  alt=<%=rs("p_name")%>></a></td>
                                                                </tr>
                                                                <tr>
                                                                  <td align="center"  height="60" valign="top"><a href="showProDetail.asp?ProID=<%=rs("p_id")%>"><%=rs("p_name")%></A></span></td>
                                                                </tr>
                                                            </table></td>
                                                            <% if i mod 4 = 0 then %>
                                                          </tr>
                                                          <tr>
                                                            <%end if%>
                                                            <%
						 rs.movenext
						 if i>=rs.pagesize then exit for                                                           
						 next
						 end if 
					 %>
                        </table>
                                                        <table width="100%">
              <tr > 
                <td > 
                  <div align="center" class="number"><span class="font3">页次：<font color=red><%=pagecount%></font>/<%=rs.pagecount%></span>　               
                    <a href="?classType=<%=classType%>&smallclass=<%=smallclass%>&key=<%=key%>&type=<%=request("type")%>" class="number"><font color="#000000">首页　</font></a>               
                    <% if pagecount=1 and rs.pagecount<>pagecount and rs.pagecount<>0 then%>　              
                    <a href="?page=<%=cstr(pagecount+1)%>&classType=<%=classType%>&smallclass=<%=smallclass%>&key=<%=key%>&type=<%=request("type")%>" class="number"><font color="#000000">下一页</font></a>               
                    <% end if %>              
                    <% if rs.pagecount>1 and rs.pagecount=pagecount then %>              
                    <a href="?page=<%=cstr(pagecount-1)%>&classType=<%=classType%>&smallclass=<%=smallclass%>&key=<%=key%>&type=<%=request("type")%>" class="number"><font color="#000000">　上一页　</font></a>               
                    <%end if%>              
                    <% if pagecount<>1 and rs.pagecount<>pagecount then%>              
                    <a href="?page=<%=cstr(pagecount-1)%>&classType=<%=classType%>&smallclass=<%=smallclass%>&key=<%=key%>&type=<%=request("type")%>" class="number"><font color="#000000">　上一页</font></a>　               
                    <a href="?page=<%=cstr(pagecount+1)%>&classType=<%=classType%>&smallclass=<%=smallclass%>&key=<%=key%>&type=<%=request("type")%>" class="number"><font color="#000000">下一页</font></a>               
                    <%end if%>              
                    <% if rs.pagecount >0 then%>              
                    <a href="?page=<%=rs.pagecount%>&classType=<%=classType%>&smallclass=<%=smallclass%>&key=<%=key%>&type=<%=request("type")%>" class="number"><font color="#000000">尾页</font></a>               
                    <% else%>              
                    <span class="font3">尾页　</span>               
                    <% end if%>　　   
                    <select name="page" onChange="location=this.options[this.selectedIndex].value" >  
                      <% 
						for i=1 to rs.pagecount
						%>
                      <option value="?page=<%=i%>&classType=<%=classType%>&smallclass=<%=smallclass%>&key=<%=key%>&type=<%=request("type")%>" <% if pagecount = i then response.Write("selected")%>>&#31532;<%=i%>&#39029;</option>
                      <%
						next
						%>
                    </select>           
                  </div></td>
              </tr>
            </table></td>
        </tr>
       </table>
      <%
rs.close
set rs=nothing
%>	   
   



