P
PiGei
hi all,
I'm using the following code to read articles from a db and show them by
columns and not by rows.
I think the code could be better... so, if you have some advice...
thanks
db= access
<%
Dim num_col 'number of columns
Dim end_row 'checking enf of row
Dim counter
num_col = 2
end_row = "false"
counter = 1
%>
<table border="1" cellpadding="2" cellspacing="2" width="450">
<%
Do While Not rstSimple.EOF
%>
<%
If end_row = "false" Then
response.write "<tr>"
End If
%>
<td>
<%= rstSimple.Fields("id").Value %><br>
<%= rstSimple.Fields("titolo").Value %><br>
<%= rstSimple.Fields("data").Value %><br>
<%= "end_row= " & end_row %><br>
<%= "counter= " & counter %><br>
<%= "num_col= " & num_col %><br>
</td>
<%
rstSimple.MoveNext
%>
<%
If counter = num_col OR rstSimple.EOF Then
response.write "</tr>"
end_row = "false"
counter = 1
%>
<%
Else
%>
<% counter = counter+1 %>
<% end_row = "true" %>
<% End If %>
<%
Loop
%>
</table>
Thanks
I'm using the following code to read articles from a db and show them by
columns and not by rows.
I think the code could be better... so, if you have some advice...
thanks
db= access
<%
Dim num_col 'number of columns
Dim end_row 'checking enf of row
Dim counter
num_col = 2
end_row = "false"
counter = 1
%>
<table border="1" cellpadding="2" cellspacing="2" width="450">
<%
Do While Not rstSimple.EOF
%>
<%
If end_row = "false" Then
response.write "<tr>"
End If
%>
<td>
<%= rstSimple.Fields("id").Value %><br>
<%= rstSimple.Fields("titolo").Value %><br>
<%= rstSimple.Fields("data").Value %><br>
<%= "end_row= " & end_row %><br>
<%= "counter= " & counter %><br>
<%= "num_col= " & num_col %><br>
</td>
<%
rstSimple.MoveNext
%>
<%
If counter = num_col OR rstSimple.EOF Then
response.write "</tr>"
end_row = "false"
counter = 1
%>
<%
Else
%>
<% counter = counter+1 %>
<% end_row = "true" %>
<% End If %>
<%
Loop
%>
</table>
Thanks