Ciao Ragazzi,
sto' creando un portale, dove gli utenti possono mandarsi messaggi privati tra di loro, ho impostato il limite massimo di messaggi privati che un'utente puo' contenere, dopo di che vorrei che quando supera il numero di messaggi da me impostati... quelli "obsoleti" vengano cancellati. A livello di logica le sto pensando tutto, ma non riesco a trovare una solouzione.
Di seguito vi posto il codice che attualmente uso:
codice:<% session("userid") = request.QueryString("id") sql = " SELECT u_msg FROM com_utenti WHERE u_id=" & session("userid") set maxmsg = conn.execute(sql) recordperpagina = maxmsg("u_msg") maxmsg.PageSize = recordperpagina maxmsg.close set maxmsg = nothing sql = " SELECT u_id, u_username, msg_mittente, msg_id, msg_destinatario, msg_titolo, msg_messaggio, msg_orario, msg_letto FROM com_utenti, com_messaggi WHERE com_messaggi.msg_mittente = com_utenti.u_id AND com_messaggi.msg_destinatario = " & session("userid") & " ORDER BY com_messaggi.msg_id DESC" set listamsg = conn.execute(sql) if listamsg.EOF = true then nomsg = "Nessun messaggio presente." elsefor i = 1 to recordperpagina if not listamsg.eof then if listamsg("msg_letto") = 1 then %> <tr bgcolor="#CCCCCC"> <td width="17"><%= i%></td> <td width="53"><input type="checkbox" name="<%= listamsg("msg_id")%>"></td> <td width="70">"><%= listamsg("u_username")%></td> <td width="182"222"">"><%= listamsg("msg_titolo")%></td> <td width="114"><%= listamsg("msg_orario")%></td> </tr> <% else %> <tr bgcolor="<%= tbsfondo%>"> <td width="17"><%= i%></td> <td width="53"><input type="checkbox"></td> <td width="70">"><%=listamsg("u_username")%></td> <td width="182">"><%= listamsg("msg_titolo")%></td> <td width="114"><%= listamsg("msg_orario") %></td> </tr> <%end if listamsg.movenext end if next end if maxmsg = i listamsg.close set listamsg = nothing %>
Grazie in anticipo, ragazzi!

Rispondi quotando
