<%response.buffer=true%> <% categoria = request.QueryString("categoria") categoria1 = request.querystring("categoria") set conexion = server.CreateObject("adodb.connection") conexion.open (strconn) 'CARGA DINAMICA DE DATOS EN LA BUSQUEDA marca=request.QueryString("marca") subcategoria=request.QueryString("subcategoria") eje=request.QueryString("ejes") rodaje=request.QueryString("rodaje") pais=request.QueryString("pais") pmat=request.QueryString("pmat") ultmat=request.QueryString("ultmat") combustible=request.QueryString("combustible") cambio=request.QueryString("cambio") strmany = "select count(*) from producto p, ruta r, usuario u, logos l where l.id_usuario=u.id_usuario and p.id_usuario=u.id_usuario and p.id_producto=r.id_producto and p.categoria='" & categoria & "'" if marca <> "" then strmany = strmany & " and p.n_marca='" & marca & "'" end if if eje <> "" then strmany = strmany & " and p.m_ejes='" & eje & "'" end if if rodaje <> "" then strmany = strmany & " and p.n_rodaje='" & rodaje & "'" end if if pais <> "" then strmany = strmany & " and n_pais='" & pais & "'" end if if pmat <> "" then strmany = strmany & " and m_ano >= '" & pmat & "'" end if if ultmat <> "" then strmany = strmany & " and m_ano <= '" & ultmat & "'" end if if subcategoria <> "" then strmany = strmany & " and p.subcategoria='" & subcategoria & "'" end if if combustible <> "" then strmany = strmany & " and p.n_combustible='" & combustible & "'" end if if cambio <> "" then strmany = strmany & " and p.n_caja='" & cambio & "'" end if strmany = strmany & " order by p.vendido, p.id_producto desc " '////////////////////////////////////////////////////////////////////////////////////////// set many = conexion.execute(strmany) cantidad = many("count(*)") conexion.close 'VISUALIZAMOS CAMIONES DE ESA CATEGORIA %> <%'PONEMOS CONDICIONAL PARA VISUALIZAR BUSQUEDA ESPECIALIZADA SEGUN CATEGORIA INTRODUCIDA if (categoria = "volquete" or categoria = "rigido" or categoria = "tractora" or categoria = "hormigonera" or categoria = "furgoneta") then %>
  Buscar en vehículo  <%=categoria%> <%=cantidad%> en stock  
Marca <%'ESTO SI FUNCIONA!!!!%> <% if marca <> "" then%> <%else%> <% end if %> Ejes: <% if eje <> "" then%> <%else%> <%end if%>
Primera matriculación: <% if pmat <> "" then%> <%else%> <%end if%> Hasta: <% if ultmat <> "" then%> <%else%> <%end if%>
País <% if pais <> "" then%> <%else%> <%end if%> Modelo
                                                                                  
<% '###################################################################################### '# CONTAMOS EL NUMERO DE FILAS '###################################################################################### Dim sQueryStatus Dim intRecordsPerPage Dim intPages Dim sLimitPart 'LIMIT 0,1 -----> LIMIT {START_NUMBER,RECORDS_PERPAGE} Dim sStartQuery Dim sMaxStart Dim sProjectPrev Dim sProjectNext intRecordsPerPage = 12 'How many records to show per page Dim sqlProjectCount Dim connCount, rsCount Dim sProjectCount '###################################################################################### 'COPIAMOS LAS VARIABLES CONTADOR DE CAMIONES PARA QUE COINCIDAN Y ASI NO TENER QUE CONTAR DE NUEVO EN LA BASE DE DATOS sqlProjectCount = strmany '#################################################################################### Set connCount = Server.Createobject("ADODB.Connection") Set rsCount = Server.CreateObject("ADODB.Recordset") 'connCount.open sDatabaseConnection connCount.open strconn Set rsCount = connCount.Execute(sqlProjectCount) If rsCount.eof then sProjectCount = 0 Else sProjectCount = rsCount.Fields(0) 'number of records End If connCount.close set connCount=nothing set rsCount=nothing 'Response.Write(sProjectCount) '###################################################################################### '# COMENZAMOS A PAGINAR '###################################################################################### sStartQuery = Request.QueryString("start") 'Get total pages sProjectCount = cint(sProjectCount) If intRecordsPerPage < sProjectCount then intPages = sProjectCount / intRecordsPerPage End If 'here we modify the number if it has a decimal, a better solution maybe would be to use formatnumber Dim instrIntPages instrIntPages = Instr(intPages,".") 'If after the decimal there is a 0 then we need to add a page If instrIntPages > 0 then intPages = Left(intPages,instrIntPages) + 1 End If 'Lets create the limit for the sql 'LIMIT 0,1 -----> LIMIT {START_NUMBER,RECORDS_PERPAGE} If sStartQuery <> "" AND isNumeric(sStartQuery) then sLimitPart = "LIMIT " & sStartQuery & "," & intRecordsPerPage Else sLimitPart = "LIMIT " & "0," & intRecordsPerPage End If 'Lets figure out what the max start number is sMaxStart = (intPages*intRecordsPerPage)-intRecordsPerPage If sStartQuery <> "" AND isNumeric(sStartQuery) then sStartQuery = CINT(sStartQuery) Else sStartQuery = 0 End If 'Now lets create our previous / next buttons and disable them if they are not needed. If sMaxStart < 0 then sMaxStart = 0 If sStartQuery = "" or sStartQuery = "0" then 'PREVIOUS DISABLED sProjectPrev = "Previous" ElseIf sStartQuery > 0 then 'PREVIOUS ENABLED sProjectPrev = "Previous" End If 'METEMOS EL VALOR DE EJE EN AXES PARA QUE LOS BOTONES 1 2 3 ... TENGAN EL MISMO VALOS QUE PREVIOUS Y NEXT axes=eje 'Next If sMaxStart = sStartQuery then 'NEXT DISABLED sProjectNext = "Next" ElseIf sStartQuery < sMaxStart then 'NEXT ENABLED sProjectNext= "Next" End If 'Now its time to select our projects Dim connP, rsP Dim sqlProjects Dim sPid Dim sSubject Dim sSubject2 Dim idusuario, aparcado, vendido Dim nomusuario, combustible, eje, ano Dim empresa '##################################################################################### sqlProjects = "select * from producto p, ruta r, usuario u, logos l where l.id_usuario=u.id_usuario and p.id_usuario=u.id_usuario and p.id_producto=r.id_producto and p.categoria='" & categoria & "'" if marca <> "" then sqlProjects = sqlProjects & " and p.n_marca='" & marca & "'" end if if eje <> "" then sqlProjects = sqlProjects & " and p.m_ejes='" & eje & "'" end if if pais <> "" then sqlProjects = sqlProjects & " and n_pais='" & pais & "'" end if if pmat <> "" then sqlProjects = sqlProjects & " and m_ano >= '" & pmat & "'" end if if ultmat <> "" then sqlProjects = sqlProjects & " and m_ano <= '" & ultmat & "'" end if sqlProjects = sqlProjects & " order by p.vendido, p.id_producto desc " & sLimitPart '##################################################################################### Set connP = Server.Createobject("ADODB.Connection") Set rsP = Server.CreateObject("ADODB.Recordset") 'connP.open sDatabaseConnection connP.open strconn contador=0 Set rsP = connP.Execute(sqlProjects) %> <% If NOT rsP.eof then Do while not rsP.eof sPid = rsP("n_marca") sSubject = rsP("n_modelo") cambio = rsP("n_caja") suspension = rsP("n_sus_trasera") categoria = rsP("categoria") subcategoria = rsP("subcategoria") sSubject2 = rsP("m_precio") ano = rsP("m_ano") eje = rsP("m_ejes") combustible = rsP("n_combustible") idusuario = rsP("id_usuario") idproducto = rsP("id_producto") aparcado=rsP("aparcado") vendido=rsP("vendido") empresa=rsP("n_empresa") pais_empresa=rsP("u_pais") tituoferta=rsP("tituoferta") 'nomusuario=rsP("nomusuario") if aparcado="No" then if vendido="Si" then %> <% if contador=3 then %> <% contador=0 end if %> <%else%> <% if contador=3 then %> <% contador=0 end if %> <%end if%> <%else%> <% if contador=3 then %> <% contador=0 end if %> <%end if%> <% rsP.movenext loop %>
<% contador=contador+1 cont2=cint(idproducto) cont2=cont2-1 %>
Ref TOP100<%=idproducto%>  .gif" width=20 height=14 border=0>
<% contador=contador+1 cont2=cint(idproducto) cont2=cont2-1 %>
Ref TOP100<%=idproducto%>  .gif" width=20 height=14 border=0>
<% contador=contador+1 cont2=cint(idproducto) cont2=cont2-1 %>
Ref TOP100<%=idproducto%>  .gif" width=20 height=14 border=0>
Total: <%=sProjectCount%>
<% Dim queryPageOn queryPageOn = Request.QueryString("page") If NOT isNumeric(queryPageOn) AND NOT sStartQuery = "0" then queryPageOn = "1" End If queryPageOn = CINT(queryPageOn) Response.Write(sProjectPrev & "  ") '# Create Page Numbers & Links Dim iPages, iPagesTemp For iPages=1 to intPages iPagesTemp = iPages-1 If NOT queryPageOn=iPages then Response.write "" & iPages & "  " Else Response.write "[" & iPages & "]  " End If Next Response.Write("  "&sProjectNext) %>
<%Else%> No se han encontrado ofertas.
  <%End IF connP.close set connP=nothing set rsP=nothing '######################################################################################### %> <%else if (categoria = "semiremolque") then%>
  Buscar en vehículo  <%=categoria%> <%=cantidad%> en stock  
Subcategoría: <% if subcategoria <> "" then%> <%else%> <%end if%> Marca: <% if marca <> "" then%> <%else%> <% end if %>
Primera matriculación: <% if pmat <> "" then%> <%else%> <%end if%> Hasta: <% if ultmat <> "" then%> <%else%> <%end if%>
País <% if pais <> "" then%> <%else%> <%end if%> Ejes: <% if eje <> "" then%> <%else%> <%end if%>
                                                                                  
<% '###################################################################################### '# CONTAMOS EL NUMERO DE FILAS '###################################################################################### intRecordsPerPage = 12 'How many records to show per page '###################################################################################### 'COPIAMOS LAS VARIABLES CONTADOR DE CAMIONES PARA QUE COINCIDAN Y ASI NO TENER QUE CONTAR DE NUEVO EN LA BASE DE DATOS sqlProjectCount = strmany '#################################################################################### Set connCount = Server.Createobject("ADODB.Connection") Set rsCount = Server.CreateObject("ADODB.Recordset") 'connCount.open sDatabaseConnection connCount.open strconn Set rsCount = connCount.Execute(sqlProjectCount) If rsCount.eof then sProjectCount = 0 Else sProjectCount = rsCount.Fields(0) 'number of records End If connCount.close set connCount=nothing set rsCount=nothing 'Response.Write(sProjectCount) '###################################################################################### '# COMENZAMOS A PAGINAR '###################################################################################### sStartQuery = Request.QueryString("start") 'Get total pages sProjectCount = cint(sProjectCount) If intRecordsPerPage < sProjectCount then intPages = sProjectCount / intRecordsPerPage End If 'here we modify the number if it has a decimal, a better solution maybe would be to use formatnumber 'Dim instrIntPages instrIntPages = Instr(intPages,".") 'If after the decimal there is a 0 then we need to add a page If instrIntPages > 0 then intPages = Left(intPages,instrIntPages) + 1 End If 'Lets create the limit for the sql 'LIMIT 0,1 -----> LIMIT {START_NUMBER,RECORDS_PERPAGE} If sStartQuery <> "" AND isNumeric(sStartQuery) then sLimitPart = "LIMIT " & sStartQuery & "," & intRecordsPerPage Else sLimitPart = "LIMIT " & "0," & intRecordsPerPage End If 'Lets figure out what the max start number is sMaxStart = (intPages*intRecordsPerPage)-intRecordsPerPage If sStartQuery <> "" AND isNumeric(sStartQuery) then sStartQuery = CINT(sStartQuery) Else sStartQuery = 0 End If 'Now lets create our previous / next buttons and disable them if they are not needed. If sMaxStart < 0 then sMaxStart = 0 If sStartQuery = "" or sStartQuery = "0" then 'PREVIOUS DISABLED sProjectPrev = "
Previous" ElseIf sStartQuery > 0 then 'PREVIOUS ENABLED sProjectPrev = "Previous" End If 'METEMOS EL VALOR DE EJE EN AXES PARA QUE LOS BOTONES 1 2 3 ... TENGAN EL MISMO VALOS QUE PREVIOUS Y NEXT axes=eje 'Next If sMaxStart = sStartQuery then 'NEXT DISABLED sProjectNext = "Next" ElseIf sStartQuery < sMaxStart then 'NEXT ENABLED sProjectNext= "Next" End If '##################################################################################### sqlProjects = "select * from producto p, ruta r, usuario u, logos l where l.id_usuario=u.id_usuario and p.id_usuario=u.id_usuario and p.id_producto=r.id_producto and p.categoria='" & categoria & "'" if marca <> "" then sqlProjects = sqlProjects & " and p.n_marca='" & marca & "'" end if if eje <> "" then sqlProjects = sqlProjects & " and p.m_ejes='" & eje & "'" end if if pais <> "" then sqlProjects = sqlProjects & " and n_pais='" & pais & "'" end if if pmat <> "" then sqlProjects = sqlProjects & " and m_ano >= '" & pmat & "'" end if if ultmat <> "" then sqlProjects = sqlProjects & " and m_ano <= '" & ultmat & "'" end if if subcategoria <> "" then sqlProjects = sqlProjects & " and p.subcategoria='" & subcategoria & "'" end if sqlProjects = sqlProjects & " order by p.vendido, p.id_producto desc " & sLimitPart '##################################################################################### Set connP = Server.Createobject("ADODB.Connection") Set rsP = Server.CreateObject("ADODB.Recordset") 'connP.open sDatabaseConnection connP.open strconn contador=0 Set rsP = connP.Execute(sqlProjects) %> <% If NOT rsP.eof then Do while not rsP.eof sPid = rsP("n_marca") sSubject = rsP("n_modelo") cambio = rsP("n_caja") suspension = rsP("n_sus_trasera") categoria = rsP("categoria") sSubject2 = rsP("m_precio") ano = rsP("m_ano") eje = rsP("m_ejes") combustible = rsP("n_combustible") idusuario = rsP("id_usuario") idproducto = rsP("id_producto") aparcado=rsP("aparcado") vendido=rsP("vendido") empresa=rsP("n_empresa") pais_empresa=rsP("u_pais") tituoferta=rsP("tituoferta") 'nomusuario=rsP("nomusuario") if aparcado="No" then if vendido="Si" then %> <% if contador=3 then %> <% contador=0 end if %> <%else%> <% if contador=3 then %> <% contador=0 end if %> <%end if%> <%else%> <% if contador=3 then %> <% contador=0 end if %> <%end if%> <% rsP.movenext loop %>
<% contador=contador+1 cont2=cint(idproducto) cont2=cont2-1 %>
Ref TOP100<%=idproducto%>  .gif" width=20 height=14 border=0>
<% contador=contador+1 cont2=cint(idproducto) cont2=cont2-1 %>
Ref TOP100<%=idproducto%>  .gif" width=20 height=14 border=0>
<% contador=contador+1 cont2=cint(idproducto) cont2=cont2-1 %>
Ref TOP100<%=idproducto%>  .gif" width=20 height=14 border=0>
Total: <%=sProjectCount%>
<% 'Dim queryPageOn queryPageOn = Request.QueryString("page") If NOT isNumeric(queryPageOn) AND NOT sStartQuery = "0" then queryPageOn = "1" End If queryPageOn = CINT(queryPageOn) Response.Write(sProjectPrev & "  ") '# Create Page Numbers & Links 'Dim iPages, iPagesTemp For iPages=1 to intPages iPagesTemp = iPages-1 If NOT queryPageOn=iPages then Response.write "" & iPages & "  " Else Response.write "[" & iPages & "]  " End If Next Response.Write("  "&sProjectNext) %>
<%Else%> No se han encontrado ofertas.
  <%End IF connP.close set connP=nothing set rsP=nothing '######################################################################################### %> <%else if (categoria = "autobus") then%>
  Buscar en vehículo  <%=categoria%> <%=cantidad%> en stock  
Subcategoría: <% if subcategoria <> "" then%> <%else%> <%end if%> Marca: <% if marca <> "" then%> <%else%> <% end if %>
Primera matriculación: <% if pmat <> "" then%> <%else%> <%end if%> Hasta: <% if ultmat <> "" then%> <%else%> <%end if%>
País <% if pais <> "" then%> <%else%> <%end if%> Modelo:
Caja Cambio <% if cambio <> "" then%> <%else%> <%end if%> Combustible: <% if combustible <> "" then%> <%else%> <%end if%>
                                                                                  
<% '###################################################################################### '# CONTAMOS EL NUMERO DE FILAS '###################################################################################### intRecordsPerPage = 12 'How many records to show per page '###################################################################################### 'COPIAMOS LAS VARIABLES CONTADOR DE CAMIONES PARA QUE COINCIDAN Y ASI NO TENER QUE CONTAR DE NUEVO EN LA BASE DE DATOS sqlProjectCount = strmany '#################################################################################### Set connCount = Server.Createobject("ADODB.Connection") Set rsCount = Server.CreateObject("ADODB.Recordset") 'connCount.open sDatabaseConnection connCount.open strconn Set rsCount = connCount.Execute(sqlProjectCount) If rsCount.eof then sProjectCount = 0 Else sProjectCount = rsCount.Fields(0) 'number of records End If connCount.close set connCount=nothing set rsCount=nothing 'Response.Write(sProjectCount) '###################################################################################### '# COMENZAMOS A PAGINAR '###################################################################################### sStartQuery = Request.QueryString("start") 'Get total pages sProjectCount = cint(sProjectCount) If intRecordsPerPage < sProjectCount then intPages = sProjectCount / intRecordsPerPage End If 'here we modify the number if it has a decimal, a better solution maybe would be to use formatnumber 'Dim instrIntPages instrIntPages = Instr(intPages,".") 'If after the decimal there is a 0 then we need to add a page If instrIntPages > 0 then intPages = Left(intPages,instrIntPages) + 1 End If 'Lets create the limit for the sql 'LIMIT 0,1 -----> LIMIT {START_NUMBER,RECORDS_PERPAGE} If sStartQuery <> "" AND isNumeric(sStartQuery) then sLimitPart = "LIMIT " & sStartQuery & "," & intRecordsPerPage Else sLimitPart = "LIMIT " & "0," & intRecordsPerPage End If 'Lets figure out what the max start number is sMaxStart = (intPages*intRecordsPerPage)-intRecordsPerPage If sStartQuery <> "" AND isNumeric(sStartQuery) then sStartQuery = CINT(sStartQuery) Else sStartQuery = 0 End If 'Now lets create our previous / next buttons and disable them if they are not needed. If sMaxStart < 0 then sMaxStart = 0 If sStartQuery = "" or sStartQuery = "0" then 'PREVIOUS DISABLED sProjectPrev = "
Previous" ElseIf sStartQuery > 0 then 'PREVIOUS ENABLED sProjectPrev = "Previous" End If 'METEMOS EL VALOR DE EJE EN AXES PARA QUE LOS BOTONES 1 2 3 ... TENGAN EL MISMO VALOS QUE PREVIOUS Y NEXT axes=eje 'Next If sMaxStart = sStartQuery then 'NEXT DISABLED sProjectNext = "Next" ElseIf sStartQuery < sMaxStart then 'NEXT ENABLED sProjectNext= "Next" End If '##################################################################################### sqlProjects = "select * from producto p, ruta r, usuario u, logos l where l.id_usuario=u.id_usuario and p.id_usuario=u.id_usuario and p.id_producto=r.id_producto and p.categoria='" & categoria & "'" if marca <> "" then sqlProjects = sqlProjects & " and p.n_marca='" & marca & "'" end if if pais <> "" then sqlProjects = sqlProjects & " and n_pais='" & pais & "'" end if if pmat <> "" then sqlProjects = sqlProjects & " and m_ano >= '" & pmat & "'" end if if ultmat <> "" then sqlProjects = sqlProjects & " and m_ano <= '" & ultmat & "'" end if if subcategoria <> "" then sqlProjects = sqlProjects & " and p.subcategoria='" & subcategoria & "'" end if if combustible <> "" then sqlProjects = sqlProjects & " and p.n_combustible='" & combustible & "'" end if if cambio <> "" then sqlProjects = sqlProjects & " and p.n_caja='" & cambio & "'" end if sqlProjects = sqlProjects & " order by p.vendido, p.id_producto desc " & sLimitPart '##################################################################################### Set connP = Server.Createobject("ADODB.Connection") Set rsP = Server.CreateObject("ADODB.Recordset") 'connP.open sDatabaseConnection connP.open strconn contador=0 Set rsP = connP.Execute(sqlProjects) %> <% If NOT rsP.eof then Do while not rsP.eof sPid = rsP("n_marca") sSubject = rsP("n_modelo") cambio = rsP("n_caja") suspension = rsP("n_sus_trasera") categoria = rsP("categoria") sSubject2 = rsP("m_precio") ano = rsP("m_ano") eje = rsP("m_ejes") combustible = rsP("n_combustible") idusuario = rsP("id_usuario") idproducto = rsP("id_producto") aparcado=rsP("aparcado") vendido=rsP("vendido") empresa=rsP("n_empresa") pais_empresa=rsP("u_pais") cambio=rsP("n_caja") combustible=rsP("n_combustible") tituoferta=rsP("tituoferta") 'nomusuario=rsP("nomusuario") if aparcado="No" then if vendido="Si" then %> <% if contador=3 then %> <% contador=0 end if %> <%else%> <% if contador=3 then %> <% contador=0 end if %> <%end if%> <%else%> <% if contador=3 then %> <% contador=0 end if %> <%end if%> <% rsP.movenext loop %>
<% contador=contador+1 cont2=cint(idproducto) cont2=cont2-1 %>
Ref TOP100<%=idproducto%>  .gif" width=20 height=14 border=0>
<% contador=contador+1 cont2=cint(idproducto) cont2=cont2-1 %>
Ref TOP100<%=idproducto%>  .gif" width=20 height=14 border=0>
<% contador=contador+1 cont2=cint(idproducto) cont2=cont2-1 %>
Ref TOP100<%=idproducto%>  .gif" width=20 height=14 border=0>
Total: <%=sProjectCount%>
<% 'Dim queryPageOn queryPageOn = Request.QueryString("page") If NOT isNumeric(queryPageOn) AND NOT sStartQuery = "0" then queryPageOn = "1" End If queryPageOn = CINT(queryPageOn) Response.Write(sProjectPrev & "  ") '# Create Page Numbers & Links 'Dim iPages, iPagesTemp For iPages=1 to intPages iPagesTemp = iPages-1 If NOT queryPageOn=iPages then Response.write "" & iPages & "  " Else Response.write "[" & iPages & "]  " End If Next Response.Write("  "&sProjectNext) %>
<%Else%> No se han encontrado ofertas.
  <%End IF connP.close set connP=nothing set rsP=nothing '######################################################################################### %> <%else if (categoria = "maquinaria") then%>
  Buscar en vehículo  <%=categoria%> <%=cantidad%> en stock  
Subcategoria <% if subcategoria <> "" then%> <%else%> <% end if %> Marca <%'ESTO SI FUNCIONA!!!!%> <% if marca <> "" then%> <%else%> <% end if %>
Primera matriculación: <% if pmat <> "" then%> <%else%> <%end if%> Hasta: <% if ultmat <> "" then%> <%else%> <%end if%>
País <% if pais <> "" then%> <%else%> <%end if%> Tipo de rodaje: <% if rodaje <> "" then%> <%else%> <%end if%>
                                                                                  
<% '###################################################################################### '# CONTAMOS EL NUMERO DE FILAS '###################################################################################### 'Dim sQueryStatus 'Dim intRecordsPerPage 'Dim intPages 'Dim sLimitPart 'LIMIT 0,1 -----> LIMIT {START_NUMBER,RECORDS_PERPAGE} 'Dim sStartQuery 'Dim sMaxStart 'Dim sProjectPrev 'Dim sProjectNext intRecordsPerPage = 12 'How many records to show per page 'Dim sqlProjectCount 'Dim connCount, rsCount 'Dim sProjectCount '###################################################################################### 'COPIAMOS LAS VARIABLES CONTADOR DE CAMIONES PARA QUE COINCIDAN Y ASI NO TENER QUE CONTAR DE NUEVO EN LA BASE DE DATOS sqlProjectCount = strmany '#################################################################################### Set connCount = Server.Createobject("ADODB.Connection") Set rsCount = Server.CreateObject("ADODB.Recordset") 'connCount.open sDatabaseConnection connCount.open strconn Set rsCount = connCount.Execute(sqlProjectCount) If rsCount.eof then sProjectCount = 0 Else sProjectCount = rsCount.Fields(0) 'number of records End If connCount.close set connCount=nothing set rsCount=nothing 'Response.Write(sProjectCount) '###################################################################################### '# COMENZAMOS A PAGINAR '###################################################################################### sStartQuery = Request.QueryString("start") 'Get total pages sProjectCount = cint(sProjectCount) If intRecordsPerPage < sProjectCount then intPages = sProjectCount / intRecordsPerPage End If 'here we modify the number if it has a decimal, a better solution maybe would be to use formatnumber 'Dim instrIntPages instrIntPages = Instr(intPages,".") 'If after the decimal there is a 0 then we need to add a page If instrIntPages > 0 then intPages = Left(intPages,instrIntPages) +1 End If 'Lets create the limit for the sql 'LIMIT 0,1 -----> LIMIT {START_NUMBER,RECORDS_PERPAGE} If sStartQuery <> "" AND isNumeric(sStartQuery) then sLimitPart = "LIMIT " & sStartQuery & "," & intRecordsPerPage Else sLimitPart = "LIMIT " & "0," & intRecordsPerPage End If 'Lets figure out what the max start number is sMaxStart = (intPages*intRecordsPerPage)-intRecordsPerPage If sStartQuery <> "" AND isNumeric(sStartQuery) then sStartQuery = CINT(sStartQuery) Else sStartQuery = 0 End If 'Now lets create our previous / next buttons and disable them if they are not needed. If sMaxStart < 0 then sMaxStart = 0 If sStartQuery = "" or sStartQuery = "0" then 'PREVIOUS DISABLED sProjectPrev = "
Previous" ElseIf sStartQuery > 0 then 'PREVIOUS ENABLED sProjectPrev = "Previous" End If 'Next If sMaxStart = sStartQuery then 'NEXT DISABLED sProjectNext = "Next" ElseIf sStartQuery < sMaxStart then 'NEXT ENABLED sProjectNext= "Next" End If 'Now its time to select our projects 'Dim connP, rsP 'Dim sqlProjects 'Dim sPid 'Dim sSubject 'Dim sSubject2 'Dim idusuario, aparcado, vendido 'Dim nomusuario, combustible, eje, ano 'Dim empresa Dim rodaje, subcategoria '##################################################################################### sqlProjects = "select * from producto p, ruta r, usuario u, logos l where l.id_usuario=u.id_usuario and p.id_usuario=u.id_usuario and p.id_producto=r.id_producto and p.categoria='" & categoria & "'" if subcategoria <> "" then sqlProjects = sqlProjects & " and p.subcategoria='" & subcategoria & "'" end if if marca <> "" then sqlProjects = sqlProjects & " and p.n_marca='" & marca & "'" end if if rodaje <> "" then sqlProjects = sqlProjects & " and p.n_rodaje='" & rodaje & "'" end if if pais <> "" then sqlProjects = sqlProjects & " and n_pais='" & pais & "'" end if if pmat <> "" then sqlProjects = sqlProjects & " and m_ano >= '" & pmat & "'" end if if ultmat <> "" then sqlProjects = sqlProjects & " and m_ano <= '" & ultmat & "'" end if sqlProjects = sqlProjects & " order by p.vendido, p.id_producto desc " & sLimitPart '##################################################################################### Set connP = Server.Createobject("ADODB.Connection") Set rsP = Server.CreateObject("ADODB.Recordset") 'connP.open sDatabaseConnection connP.open strconn contador=0 Set rsP = connP.Execute(sqlProjects) %> <% If NOT rsP.eof then Do while not rsP.eof sPid = rsP("n_marca") sSubject = rsP("n_modelo") cambio = rsP("n_caja") suspension = rsP("n_sus_trasera") categoria = rsP("categoria") subcategoria = rsP("subcategoria") sSubject2 = rsP("m_precio") ano = rsP("m_ano") 'eje = rsP("m_ejes") rodaje = rsP("n_rodaje") combustible = rsP("n_combustible") idusuario = rsP("id_usuario") idproducto = rsP("id_producto") aparcado=rsP("aparcado") vendido=rsP("vendido") empresa=rsP("n_empresa") pais_empresa=rsP("u_pais") tituoferta=rsP("tituoferta") 'nomusuario=rsP("nomusuario") if aparcado="No" then if vendido="Si" then %> <% if contador=3 then %> <% contador=0 end if %> <%else%> <% if contador=3 then %> <% contador=0 end if %> <%end if%> <%else%> <% if contador=3 then %> <% contador=0 end if %> <%end if%> <% rsP.movenext loop %>
<% contador=contador+1 cont2=cint(idproducto) cont2=cont2-1 %>
Ref TOP100<%=idproducto%>  .gif" width=20 height=14 border=0>
<% contador=contador+1 cont2=cint(idproducto) cont2=cont2-1 %>
Ref TOP100<%=idproducto%>  .gif" width=20 height=14 border=0>
<% contador=contador+1 cont2=cint(idproducto) cont2=cont2-1 %>
Ref TOP100<%=idproducto%>  .gif" width=20 height=14 border=0>
Total: <%=sProjectCount%>
<% 'Dim queryPageOn queryPageOn = Request.QueryString("page") If NOT isNumeric(queryPageOn) AND NOT sStartQuery = "0" then queryPageOn = "1" End If queryPageOn = CINT(queryPageOn) Response.Write(sProjectPrev & "  ") '# Create Page Numbers & Links 'Dim iPages, iPagesTemp For iPages=1 to intPages iPagesTemp = iPages-1 If NOT queryPageOn=iPages then Response.write "" & iPages & "  " Else Response.write "[" & iPages & "]  " End If Next Response.Write("  "&sProjectNext) %>
<%Else%> No se han encontrado ofertas.
  <%End IF connP.close set connP=nothing set rsP=nothing '######################################################################################### %> <%end if%> <%end if%> <%end if%> <%end if%>