<%
if cod_categoria="" then
set rs=conexao.execute("SELECT (SELECT COUNT(cod_foto) FROM fotos WHERE fotos.cod_categoria=categorias.cod_categoria) as total, cod_categoria, nome FROM categorias ORDER BY nome ASC ")
if rs.eof=false then
%>
<%
rs.close
end if
set rs=nothing
elseif cod_categoria<>"" then
if cod_subcategoria="" then
set rs=conexao.execute("SELECT legenda, imagem FROM fotos WHERE cod_categoria="&cod_categoria&" ORDER BY cod_foto DESC")
elseif cod_subcategoria<>"" then
set rs=conexao.execute("SELECT legenda, imagem FROM fotos WHERE cod_categoria="&cod_categoria&" AND cod_subcategoria="&cod_subcategoria&" ORDER BY cod_foto DESC")
end if
if rs.eof then
response.Write("Não foi encontrada nenhuma foto.")
else
%>
| Clique na imagem para ampliá-la. |
<%
rs.movefirst
while (not rs.eof)
%>
<%
rs.movenext
wend
rs.close
end if
set rs=nothing
end if
%>