I have some ASP code here. It's a recordset that displays a from the coordinates of a database. The database has two data inputs. Column 1 is "Row" And column 2 is "Column" They act as x and y coordinates for a table. The recordset loops through all of the rows, displaying as many "td" "/td"'s as there are columns for that particular row. Then when a new row value is found, it throws in a "/tr" "tr"
The database has 900 entries, which make up a 30 x 30 table on my web site.
All of the rows are perfectly fine except rows 4 and 6. They seem to have jumped around on me a little bit:
Row 1: All 30 TD's
Row 2: All 30 TD's
Row 3: All 30 TD's
Row 4: The first 4 TD's of row 4 are there, and then TD's 24-30 of row 4, For a total of 20 TD's in this row
Row 5: All 30 TD's
Row 6: TD's 1 - 12 of Row 6 are here
Row 7: Row 4's 5-23 are here
Row 8: Row 6's 13 - 30 are here
Row 9: All 30 TD's of row 7
Row 10: All 30 TD's of row 8
Row 11: All 30 TD's of row 9, etc cleanly through row 30
The Recordset Code, if you can translate it:
<center>
<table style="background-image: url(/Images/Castletown.bmp);background-repeat: no-repeat" border=0 cellpadding=0 cellspacing=0 width=710 height=592>
<%
Response.Write("<tr>")
rs.Open "Select * from CastleTown", conn
%>
<%do until rs.EOF%>
<%for each x in rs.Fields%>
<%
TableRow2 = rs("Row")
TableData2 = rs("Column")
If TableRow2 <> TableRow1 Then
Response.Write("</tr><tr>")
End If
If TableRow2 = TableRow1 And TableData2 <> TableData1 Or TableRow2 <> TableRow1 Then
TableRow1 = rs("Row")
TableData1 = rs("Column")
PropTaken = rs("Taken")
%>
<%
If PropTaken = "Yes" Then
%>
<td>
<%
Response.Write(" ")
ElseIf PropTaken = "No" Then
%>
<td class="row1" style="cursor:hand;" onclick="window.location.href='Property.asp?Area=Hylia&Row=<%=TableRow2%>&Col=<%=TableData2%>'">
<img src="images/PropNotTaken.gif" border="0">
<%
Else
Response.Write("<td>")
End If
%>
</td>
<%
End If
%>
<%next
rs.MoveNext%>
<%loop
rs.close
%>
</tr>
</table>
</center>
You'll also notice some dual taking of the Row and Column recordset, that is so it checks to see if the row has changed, so it doesn't display the same thing twice.