Getting a correctly formatted table from a GetRows array

L

Laphan

Hi All

Somebody kindly sent me a routine to do this sometime ago, but for the life
of me I can't work out how it works and would prefer to use a simpler method
so that I can resolve any future issues with it.

Basically I have an array populated from a recordset getrows and I want to
create a nicely formatted table of this data with all of the right columns.

If my array consists of 8 rows of data and I want my table to display this
array 3 columns wide then the routine needs to make sure that it drops the
array rows onto enough table rows to show them all, eg:

< data1 > < data1 > < data1 >
< data1 > < data1 > < data1 >
< data1 > < data1 > < create the <TD></TD> bit but obviously leave it
blank >

Any help you can give would be very much appreciated.

The code I currently use, but don't understand is as follows:

Response.Write "<TABLE CELLSPACING=0 CELLPADDING=0 CLASS='ProdFullDesc'
BORDER=0>"

intArrayCount = UBound(arrSQLData,2)
intStartRow = 1

IF intArrayCount mod 3 = 0 THEN
intColDiff = CInt(intArrayCount \ 3)
ELSE
intColDiff = CInt(intArrayCount \ 3) + 1
END IF

FOR x = 1 TO intColDiff
Response.Write "<TR>"
intTargetRow = intStartRow
z=0

FOR y = 0 to intArrayCount
IF y = intTargetRow-1 THEN
Response.Write "<TD ALIGN='CENTER'><IMG SRC='"
Response.Write cImageGalleryFolderPath & arrSQLData(0,y) & "'
BORDER=0><BR>"
Response.Write arrSQLData(1,y) & "</TD>"
intTargetRow = intTargetRow + intColDiff
END IF
NEXT

Response.Write "</TR><TR><TD COLSPAN=" & intColDiff & "
HEIGHT=10></TD></TR>"
intStartRow = intStartRow + 1
NEXT

Response.Write "</TABLE><BR>"
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,053
Latest member
BrodieSola

Latest Threads

Top