Hi everyone.
I have problem whit paging ASP and MySQL.
This code not working :
PageSize = 10
Number of records = 1
PageCount = 1/10 = 1
Was going on ?
Can you help me?
I have problem whit paging ASP and MySQL.
This code not working :
PageSize = 10
Number of records = 1
PageCount = 1/10 = 1
Code:
Function excess(argValue) if not (int(argValue) = argValue) then argValue = int(argValue)+1 excess = argValue end Function pageSize = 10 if(len(Request.QueryString("pagina"))=0)then currentPage = 1 else currentPage = CInt(Request.QueryString("pagina")) end if sql_count = " SELECT * " sql_count = sql_count & " , COUNT(*) AS CNT " sql_count = sql_count & " , COUNT(TIPO) AS totale_tipo " sql_count = sql_count & " FROM " sql_count = sql_count & " tbl " sql_count = sql_count & " GROUP BY " sql_count = sql_count & " TIPO, DATA " sql_count = sql_count & " ORDER BY " sql_count = sql_count & " DATA ASC " sql_count = sql_count & " LIMIT " & (currentPage - 1) * pageSize & ", " & pageSize Set RS = Server.CreateObject("ADODB.Recordset") RS.Open sql_count, cn If Not RS.eof Then recordCount = RS("CNT") pageCount = excess(clng(recordCount) / clng(pageSize)) for i = 1 to pageCount Response.Write("<a href=""pag.asp?pagina=" & i & """>" & i & "</a> ") next end if RS.Close Set RS = Nothing cn.Close Set cn = Nothing
Can you help me?
Comment