Salve ragazzi, vorrei si vedesse il numero dei commenti in home sul mio sito, come contarli?
Ho un database.mdb con interni "news" e "commenti" e proprio questo fatto che sono due separate le ho chiamate RecSet e Rs, dove sto sbagliando?
In sostanza se metto in fondo WHERE pagina ='93'" per esempio mi fa la somma dei commenti tipo 6006, ma COME FACCIO A PASSARE LO STESSO ID DELLA NEWS?
<%
url_DB = "driver={Microsoft Access Driver (*.mdb)};dbq=" & server.mappath("/mdb-database/database.mdb")
Set Conn = Server.CreateObject("ADODB.Connection")
conn.Open url_DB
Set RecSet = Server.CreateObject("ADODB.Recordset")
SQL = "SELECT TOP 10 * FROM news WHERE Category ='Events' ORDER BY ID DESC"
RecSet.Open SQL, Conn, adOpenStatic, adLockOptimistic
If RecSet.Eof = False Then
set rs=conn.execute ("Select SUM(pagina) as totale from comments WHERE pagina =(ID)")
%>
<TABLE width="600" cellSpacing="0" cellPadding="0" border="0">
<tr>
<TD vAlign=top align="right" width=74%>
<DIV id=header_boxes style="WIDTH: 610px; border-top: #cdcdcd 1px solid; padding-left: 0px; padding-top: 10px; margin-bottom: -12px; FLOAT: left; background: #ffffff; FONT-SIZE: 0.9em FONT-FAMILY: Helvetica, Arial, sans-serif; FLOAT: left; COLOR: #555"><H1>Events</H1></DIV>
<h4 class="clearfix">
<span class="date">[img]2011/rss.png[/img] Click & subscribe Riders feed</span>
</h4></td>
<TD vAlign=top width=26%></td>
</tr>
<%
' VISUALIZZA LE PRIME 10 NEWS
Do until RecSet.Eof
%>
<TR style="WIDTH: 620px; border-bottom: #cdcdcd 1px solid; padding-bottom: 8px; padding-top: 9px; FLOAT: left; background: #ffffff;
FONT-SIZE: 0.90em FONT-FAMILY: Helvetica, Arial, sans-serif; FLOAT: left; COLOR: #555">
<TD vAlign=top width=26%>
<h4 class="clearfix">
<span class="date">[img]system/pt.gif[/img]<%=RecSet("Date")%></span>
</h4>
<span class="photo"><a href='read_news_comments.asp?id=<%=RecSet("id")%>' class="photo">[img]<%=RecSet("Preview")%>[/img]</span>
</a>
</td>
<TD vAlign=top width=74%>
<DIV style="margin-left: 0px; margin-top: 1px; FLOAT: left; FONT-FACE: inherit">
"><span class="title"><%=RecSet("Title")%></span>
<span class="subtitle"><DIV style="FONT-SIZE: 1.0em; FONT-FAMILY: Helvetica, Arial, sans-serif; color: #777777"><%=RecSet("Subtitle")%></div></span>
</div>
<DIV style="margin-left: 0px; margin-top: 33px; FLOAT: left; FONT-FACE: inherit">
<img src=system/article.png border=0 height=15 width=13> <a href='read_news_comments.asp?id=<%=RecSet("id")%>' class="read"><font size="1"
face="verdana" color="#000080">Read More</font></a>|<font size="1" face="verdana" color="#000080">Comments (<%=rs("totale")/RecSet("ID")%>)
</font></div>
</td>
</tr>
<%
RecSet.Movenext
Loop
%>
help pls! a buon rendere

Rispondi quotando