ho messo 7 news per pagina ma quando vado alla seconda pagina mi esce ?pag=2
sicuramente tralascio qualcosa ecco il codice
inizio poi dove escono le newscodice:<%@LANGUAGE="VBSCRIPT"%> <% dim LCID LCID = 1040 Session.LCID=LCID on error resume next parola=request.QueryString("parola") Dim cn Set cn = Server.CreateObject("ADODB.Connection") cn.ConnectionString="dsn=vincere;" cn.open Dim rs, sql Set rs = Server.CreateObject("ADODB.Recordset") sql = "SELECT data, stralcio, id, vincita FROM news WHERE testo LIKE '%"&parola&"%' ORDER by data DESC, id DESC " Set rs.ActiveConnection = cn rs.CursorType = adOpenKeyset rs.LockType = adLockOptimistic rs.Open sql, cn rs_numRows = 0 Dim Repeat1__numRows Dim Repeat1__index Repeat1__numRows = 10 Repeat1__index = 0 Numerazione_Max = 7 rs_numRows = rs_numRows + Repeat1__numRows rs.PageSize = Repeat1__numRows Pag = CInt(Request.Querystring("pag")) If (Not rs.Eof) Then If Pag>rs.PageCount Then Pag = rs.PageCount End If If Pag = 0 Then Pag = 1 End If rs.AbsolutePage = Pag indice_inizio = pag-(Numerazione_Max/2) If (indice_inizio>(rs.PageCount-Numerazione_Max)) Then indice_inizio = rs.PageCount-Numerazione_Max+1 End If If (indice_inizio<=0) Then indice_inizio = 1 End if indice_fine=indice_inizio+Numerazione_Max-1 If (indice_fine>rs.PageCount) Then indice_fine = rs.PageCount End If indice_inizio = CInt(indice_inizio) indice_fine = CInt(indice_fine) Link = "Primo record " If (indice_inizio<>1) Then Link=Link&"... " End If For i=indice_inizio to indice_fine If (i=pag) then Link = Link&"]"&i&"[" Else Link = Link&"["&i&"]" End If Next If (indice_fine<rs.PageCount-1) Then Link = Link&"... " End If Link=Link&" Ultimo record " End If Dim rs_total Dim rs_first Dim rs_last ' set the record count rs_total = rs.RecordCount ' FINE DEL PRIMO PEZZO ------------------------ %>
codice:<% cont=0 While ((Repeat1__numRows <> 0) AND (NOT rs.EOF)) if cont mod 2 = 0 then bgcolor="#E4E3FD" else bgcolor="#f1f4f6" end if cont=cont+1 %> <div class="centro1"><div class="box"><%=rs("data")%> &pag=<%=pag%>"><%=rs("stralcio")%> <%=rs("vincita")%></div></div> <% Repeat1__index=Repeat1__index+1 Repeat1__numRows=Repeat1__numRows-1 rs.MoveNext() Wend %> 'questo è per andare avanti di una pagina <div class="box"><%=Response.Write(Link)%></div></div> <% rs.Close Set rs=Nothing cn.Close Set cn=Nothing %>![]()

Rispondi quotando