Sale amici ho un forum sul mio sito dove appaiono le discussioni che sono aperte. Naviagando su questo forum ho notato che ogni volta che do una risposta, il messaggio viene visualizzato al primo posto. Come posso fare?
Posto il codice del forum:
<%@ LANGUAGE = JScript %>
<%
// Quanti record per pagina?
var quanti = 5;
Response.Expires = 0;
var mese = new Array(
"Gennaio","Febbraio","Marzo","Aprile",
"Maggio","Giugno","Luglio","Agosto",
"Settembre","Ottobre","Novembre","Dicembre"
);
function outputData(d) {
giorno = d.getDate() + " " +
mese[d.getMonth()] + " " +
d.getFullYear();
ora = new String(d.getHours());
minuti = new String(d.getMinutes());
if (minuti.length==1) minuti = "0" + minuti;
return giorno + " " + ora + ":" + minuti;
}
var pagina = parseInt(Request.QueryString("p"));
if (isNaN(pagina) || pagina<1) pagina = 1;
%>
<%
var sql = "";
sql += "SELECT ";
sql += "Intestazioni.Intestazione_ID, ";
sql += "Intestazioni.Data, ";
sql += "Intestazioni.Oggetto, ";
sql += "Intestazioni.Risposte, ";
sql += "Utenti.Nickname ";
sql += "FROM Intestazioni, Utenti WHERE ";
sql += "Intestazioni.Autore = Utenti.Utente_ID ";
sql += "ORDER BY Data DESC";
var ADOConnection = new ActiveXObject("ADODB.Connection");
var ADORecordset = new ActiveXObject("ADODB.Recordset");
ADOConnection.Open(sdc);
ADORecordset.Open(sql,ADOConnection,3,1);
if (!ADORecordset.EOF) {
ADORecordset.PageSize = quanti;
ADORecordset.AbsolutePage = pagina;
i = 0;
%>
<table width="100%" cellpadding="0" cellspacing="0">
<tr>
<td width="84%"> [img]images/argomento.gif[/img]
[img]images/spacer.gif[/img]</td>
<td width="16%">
<div align="right">[img]images/autore.gif[/img]
[img]images/spacer.gif[/img] </div>
</td>
</tr>
<tr>
<% while (i<quanti && !ADORecordset.EOF) { %>
<td width="84%" height="23">
<table width="100%" cellspacing="0" cellpadding="0">
<tr>
<td width="827" height="20">"><%=Server.HTMLEncode(ADORecordset("Oggetto") )%></td>
</tr>
</table>
</td>
<td width="16%" height="23">
<table width="91%" cellspacing="0" cellpadding="0">
<tr>
<td height="20">
<div align="right"><font size="1" face="Tahoma, Arial, Helvetica, sans-serif"><%=Server.HTMLEncode(ADORecordset("Nickname "))%></font></div>
</td>
</tr>
</table>
</td>
</tr>
<% ADORecordset.MoveNext();
i++;
} %>
</table>
<%
tot = ADORecordset.PageCount;
start = pagina - 1;
stop = pagina + 1;
if (start<1) stop += (-start) + 5;
if (stop>tot) start -= (stop - tot);
if (start<1) start = 5;
if (stop>tot) stop = tot;
script = Request.ServerVariables("SCRIPT_NAME");
Response.Write("<div align=\"center\">");
for (i=start;i<=stop;i++)
if (i!=pagina) {
Response.Write("[<a href=\"" + script + "?p=" + i + "\">");
Response.Write(i);
Response.Write("</a>]");
} else if (start!=stop) {
Response.Write("[" + i + "]");
}
Response.Write("</div>");
}
ADORecordset.Close();
ADOConnection.Close();
%>
Ciao e grazie

Rispondi quotando

