Carissimi
non riesco a capire l'errore, in pratica
se il campo EVIDENZA è si
deve leggere l'ultimo id che abbia nel campo EVIDENZA il SI
altrimenti
deve leggere l'ultimo id che abbia nel campo PUBBLICA il SI
In pratica se l'evidenza e SI pubblica sarà su NO e viceversa.
Penso di aver fatto giusto ma così mi stampa a video l'ultimo id disponibile il cui campo PUBBLICA e su SI, come mai?
codice:
<head>
<meta http-equiv="Content-Language" content="it">
</head>
<%
sql = "SELECT * FROM news WHERE categoria = 'Cronaca' or categoria = 'Politica' or categoria ='Culturaspettacolo' or categoria = 'Sport' or categoria ='Associazioni' ORDER BY ID DESC"
set rs = Server.CreateObject("ADODB.Recordset")
rs.Open sql, Conn, 3, 3
%>
<%
if rs.fields("evidenza") = "SI" then
%>
<%
sql = "SELECT * FROM news WHERE (categoria = 'Cronaca' or categoria = 'Politica' or categoria ='Culturaspettacolo' or categoria = 'Sport' or categoria ='Associazioni') AND evidenza = 'SI' order by id desc"
set rs = Server.CreateObject("ADODB.Recordset")
rs.Open sql, Conn, 3, 3
%>
<table border="0" width="529" cellspacing="1" height="120" id="table1" border="0">
<tr>
<td width="77" height="120">[img]square.aspx?img=public/admin/fotonews/<%=rs.fields([/img]&opx=120" align="LEFT" ></td>
<td width="445"><font face="Tahoma" size="3">[b]
<table border="0" width="445" cellspacing="0" cellpadding="0" id="table2" height="117">
<tr>
<td height="22"><font face="Tahoma" size="4">[b]<a href="l_news.asp?id=<%=rs.fields("id")%>" class="over_link">
<font color="#000000"><%=replace(rs.Fields.Item("titolo").Value, VbCrLf, "
")%></font></a></td>
</tr>
<tr>
<td valign="top"> <p align="justify"><font face="Tahoma" size="2" >
<%
news = replace(rs.Fields.Item("testo").Value, VbCrLf, "
")
if len(news) > 350 then
Response.Write Left(news,350) & "http://...<font face=""Tahoma"" size...i tutto</font>"
else
Response.Write Left(news,350) & ""
end if
%>
</td>
</tr>
</table>
</font>
</tr>
</table>
<%
rs.close
set rs=Nothing
conn.Close
set conn=Nothing
%>
<%
else
%>
<%
sql = "SELECT * FROM news WHERE (categoria = 'Cronaca' or categoria = 'Politica' or categoria ='Culturaspettacolo' or categoria = 'Sport' or categoria ='Associazioni') AND pubblica = 'SI' order by id desc"
set rs = Server.CreateObject("ADODB.Recordset")
rs.Open sql, Conn, 3, 3
%>
<table border="0" width="529" cellspacing="1" height="120" id="table1" border="0">
<tr>
<td width="77" height="120">[img]square.aspx?img=public/admin/fotonews/<%=rs.fields([/img]&opx=120" align="LEFT" ></td>
<td width="445"><font face="Tahoma" size="3">[b]
<table border="0" width="445" cellspacing="0" cellpadding="0" id="table2" height="117">
<tr>
<td height="22"><font face="Tahoma" size="4">[b]<a href="l_news.asp?id=<%=rs.fields("id")%>" class="over_link">
<font color="#000000"><%=replace(rs.Fields.Item("titolo").Value, VbCrLf, "
")%></font></a></td>
</tr>
<tr>
<td valign="top"> <p align="justify"><font face="Tahoma" size="2" >
<%
news = replace(rs.Fields.Item("testo").Value, VbCrLf, "
")
if len(news) > 350 then
Response.Write Left(news,350) & "http://...<font face=""Tahoma"" size...i tutto</font>"
else
Response.Write Left(news,350) & ""
end if
%>
</td>
</tr>
</table>
</font>
</tr>
</table>
<%
rs.close
set rs=Nothing
conn.Close
set conn=Nothing
%>
<%
end if
%>
Grazie
G.