472,372 Members | 1,423 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,372 software developers and data experts.

table rows

hey gang. i have a question that is probably simple, and i could do it at
one time, but i forget how.

ok, how to explain

i need to retrieve records from a db. which is no problem. but instead of
displaying them with normal rows, i need to display them across 2 columns,
then down.

here is the example
http://scrimwars.gig-gamers.com/test1.asp

this way, with the sort, i can show 1 and 2 on the same line... 3 and 4 on
the same line and so on.

i know it will have to do with an i MOD, but not sure how to set it up.

can someone get me going here. here is what i have so far.
<%

Set matches1 = Conn.Execute("SELECT clan_initials FROM clans ORDER BY wins
desc")

i = 1
DO UNTIL matches1.EOF

IF NOT i MOD 2 = 0 THEN
opposition = matches1.Fields("clan_initials").Value

%>
not not sure how to set the table up here
Nov 21 '06 #1
7 1538
Jeff wrote on 21 nov 2006 in microsoft.public.inetserver.asp.general:
hey gang. i have a question that is probably simple, and i could do it
at one time, but i forget how.

ok, how to explain

i need to retrieve records from a db. which is no problem. but instead
of displaying them with normal rows, i need to display them across 2
columns, then down.

here is the example
http://scrimwars.gig-gamers.com/test1.asp

this way, with the sort, i can show 1 and 2 on the same line... 3 and
4 on the same line and so on.

i know it will have to do with an i MOD, but not sure how to set it
up.

can someone get me going here. here is what i have so far.
<%

Set matches1 = Conn.Execute("SELECT clan_initials FROM clans ORDER BY
wins desc")

i = 1
DO UNTIL matches1.EOF

IF NOT i MOD 2 = 0 THEN
opposition = matches1.Fields("clan_initials").Value

%>
If I understand you correctly, you want:

1 2
3 4
5 6
7

try:

newRow = true
response.write "<table>"
DO UNTIL matches1.EOF
if newRow then response.write "<tr>"
newRow = not newRow
response.write "<td>" & matches1("fieldname")
matches1.MoveNext
Loop
if not newRow then response.write "<td>&nbsp;"
response.write "</table>"

not tested

--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)
Nov 21 '06 #2

"Jeff" <gi*****@adelphia.netwrote in message
news:uK******************************@adelphia.com ...
hey gang. i have a question that is probably simple, and i could do it at
one time, but i forget how.

ok, how to explain

i need to retrieve records from a db. which is no problem. but instead of
displaying them with normal rows, i need to display them across 2 columns,
then down.

here is the example
http://scrimwars.gig-gamers.com/test1.asp

this way, with the sort, i can show 1 and 2 on the same line... 3 and 4 on
the same line and so on.

i know it will have to do with an i MOD, but not sure how to set it up.

can someone get me going here. here is what i have so far.
<%

Set matches1 = Conn.Execute("SELECT clan_initials FROM clans ORDER BY wins
desc")

i = 1
DO UNTIL matches1.EOF

IF NOT i MOD 2 = 0 THEN
opposition = matches1.Fields("clan_initials").Value

%>
not not sure how to set the table up here
See my answer to subject 'Qry data to Page' posted by BaWork on 20 Nov 2006
02:48 GMT

The advantage to using a Mod is that the number of columns can be changed by
simply changing the operand in the Mod function.
Nov 21 '06 #3

"Anthony Jones" <An*@yadayadayada.comwrote in message
news:OS**************@TK2MSFTNGP04.phx.gbl...
>
"Jeff" <gi*****@adelphia.netwrote in message
news:uK******************************@adelphia.com ...
>hey gang. i have a question that is probably simple, and i could do it at
one time, but i forget how.

ok, how to explain

i need to retrieve records from a db. which is no problem. but instead of
displaying them with normal rows, i need to display them across 2
columns,
then down.

here is the example
http://scrimwars.gig-gamers.com/test1.asp

this way, with the sort, i can show 1 and 2 on the same line... 3 and 4
on
the same line and so on.

i know it will have to do with an i MOD, but not sure how to set it up.

can someone get me going here. here is what i have so far.
<%

Set matches1 = Conn.Execute("SELECT clan_initials FROM clans ORDER BY
wins
desc")

i = 1
DO UNTIL matches1.EOF

IF NOT i MOD 2 = 0 THEN
opposition = matches1.Fields("clan_initials").Value

%>
not not sure how to set the table up here

See my answer to subject 'Qry data to Page' posted by BaWork on 20 Nov
2006
02:48 GMT

The advantage to using a Mod is that the number of columns can be changed
by
simply changing the operand in the Mod function.

i have looked at that. the scripting makes sense.
i guess i am just having a problem with the html part.
i can't get it to put "against" between the two columns. let me show my
code.

<%
Set teams = Conn.Execute("SELECT clan_initials, wins FROM clans ORDER BY
wins desc")
%>
<div align="center">
<table height="55" border="0" cellpadding="0" cellspacing="0"
bordercolor="#000000" id="AutoNumber1" width="58">
<tr>

<%
i = 1
DO UNTIL teams.EOF
w1 = teams.fields.item("wins").value
t1 = trim(teams.fields.item("clan_initials").value)

IF NOT i MOD 2 = 0 THEN
%>
<td width="30">
<div align="center">
<table width="100%" border="1" cellspacing="1" bordercolorlight="#66B2F8"
bordercolordark="#175085">
<tr>
<td width="50" bgcolor="#175085" align="center"><div
align="center"><font face="Georgia" size="2" font color="#FFFFFF">
<b>1<%=t1%></b></div></td>
</tr>
<tr>
<td width="50" bgcolor="#66B2F8" align="center"><div
align="center"><font face="Georgia" size="2" font color="#000000">
<b>1<%=w1%></b></div></td>
</tr</table></div</td>
<% ELSE %>
<td width="28">
<div align="center">
<table width="100%" border="1" cellspacing="1" bordercolorlight="#66B2F8"
bordercolordark="#175085">
<tr>
<td width="50" bgcolor="#175085" align="center"><div
align="center"><font face="Georgia" size="2" font color="#FFFFFF">
<b>1<%=t1%></b></div></td>
</tr>
<tr>
<td width="50" bgcolor="#66B2F8" align="center"><div
align="center"><font face="Georgia" size="2" font color="#000000">
<b>1<%=w1%></b></div></td>
</tr</table></div</td></tr></table>
<table cellpadding="0" cellspacing="0"><tr>
<%
END IF
i = i + 1
teams.MoveNext
LOOP
%>
</table </table>
</div>

this is how that code appears now
http://scrimwars.gig-gamers.com/schedule2.asp

would have prefered it on the same table, and just show up as rows, but i
have forgotten more than i know about doing this.
Nov 21 '06 #4

"Jeff" <gi*****@adelphia.netwrote in message
news:sa******************************@adelphia.com ...
>
"Anthony Jones" <An*@yadayadayada.comwrote in message
news:OS**************@TK2MSFTNGP04.phx.gbl...

"Jeff" <gi*****@adelphia.netwrote in message
news:uK******************************@adelphia.com ...
hey gang. i have a question that is probably simple, and i could do it
at
one time, but i forget how.

ok, how to explain

i need to retrieve records from a db. which is no problem. but instead
of
displaying them with normal rows, i need to display them across 2
columns,
then down.

here is the example
http://scrimwars.gig-gamers.com/test1.asp

this way, with the sort, i can show 1 and 2 on the same line... 3 and 4
on
the same line and so on.

i know it will have to do with an i MOD, but not sure how to set it up.

can someone get me going here. here is what i have so far.
<%

Set matches1 = Conn.Execute("SELECT clan_initials FROM clans ORDER BY
wins
desc")

i = 1
DO UNTIL matches1.EOF

IF NOT i MOD 2 = 0 THEN
opposition = matches1.Fields("clan_initials").Value

%>
not not sure how to set the table up here
See my answer to subject 'Qry data to Page' posted by BaWork on 20 Nov
2006
02:48 GMT

The advantage to using a Mod is that the number of columns can be
changed
by
simply changing the operand in the Mod function.

i have looked at that. the scripting makes sense.
i guess i am just having a problem with the html part.
i can't get it to put "against" between the two columns. let me show my
code.

<%
Set teams = Conn.Execute("SELECT clan_initials, wins FROM clans ORDER BY
wins desc")
%>
<div align="center">
<table height="55" border="0" cellpadding="0" cellspacing="0"
bordercolor="#000000" id="AutoNumber1" width="58">
<tr>

<%
i = 1
DO UNTIL teams.EOF
w1 = teams.fields.item("wins").value
t1 = trim(teams.fields.item("clan_initials").value)

IF NOT i MOD 2 = 0 THEN
%>
<td width="30">
<div align="center">
<table width="100%" border="1" cellspacing="1" bordercolorlight="#66B2F8"
bordercolordark="#175085">
<tr>
<td width="50" bgcolor="#175085" align="center"><div
align="center"><font face="Georgia" size="2" font color="#FFFFFF">
<b>1<%=t1%></b></div></td>
</tr>
<tr>
<td width="50" bgcolor="#66B2F8" align="center"><div
align="center"><font face="Georgia" size="2" font color="#000000">
<b>1<%=w1%></b></div></td>
</tr</table></div</td>
<% ELSE %>
<td width="28">
<div align="center">
<table width="100%" border="1" cellspacing="1" bordercolorlight="#66B2F8"
bordercolordark="#175085">
<tr>
<td width="50" bgcolor="#175085" align="center"><div
align="center"><font face="Georgia" size="2" font color="#FFFFFF">
<b>1<%=t1%></b></div></td>
</tr>
<tr>
<td width="50" bgcolor="#66B2F8" align="center"><div
align="center"><font face="Georgia" size="2" font color="#000000">
<b>1<%=w1%></b></div></td>
</tr</table></div</td></tr></table>
<table cellpadding="0" cellspacing="0"><tr>
<%
END IF
i = i + 1
teams.MoveNext
LOOP
%>
</table </table>
</div>

this is how that code appears now
http://scrimwars.gig-gamers.com/schedule2.asp

would have prefered it on the same table, and just show up as rows, but i
have forgotten more than i know about doing this.
I see. The solution had a flaw if you want to adjust the number of columns.
The following is better and adjusted to your requirments:-
<table>
<tr><td>
<%
Const cColumnCount = 2
Dim i : i = 1
Dim fldWins : Set fldWins = rs("wins")
Dim fldIntiials : Set fldInitials = rs("clan_initials")
Do Until rs.EOF

DrawCell fldInitials.Value, fldWins.Value

rs.MoveNext

If Not rs.EOF Then
If (i Mod cColumnCount) <0 Then
Response.Write "</td><td>"
Else
Response.Write "</td></tr><td>"
End If
End If
i = i + 1
Loop
%>
</td></tr>
</table>
<%
Function DrawCell(initals, wins)
%>
<div align="center">
<table width="100%" border="1" cellspacing="1" bordercolorlight="#66B2F8"
bordercolordark="#175085">
<tr>
<td width="50" bgcolor="#175085" align="center"><div
align="center"><font face="Georgia" size="2" font color="#FFFFFF">
<b>1<%=intials%></b></div></td>
</tr>
<tr>
<td width="50" bgcolor="#66B2F8" align="center"><div
align="center"><font face="Georgia" size="2" font color="#000000">
<b>1<%=wins%></b></div></td>
</tr</table></div>
<%
End Function
%>

Although I think you could lose the <b><fontand <divelements and use CSS
styles to tidy this up a lot.

Nov 21 '06 #5
"
I see. The solution had a flaw if you want to adjust the number of
columns.
The following is better and adjusted to your requirments:-
<table>
<tr><td>
<%
Const cColumnCount = 2
Dim i : i = 1
Dim fldWins : Set fldWins = rs("wins")
Dim fldIntiials : Set fldInitials = rs("clan_initials")
Do Until rs.EOF

DrawCell fldInitials.Value, fldWins.Value

rs.MoveNext

If Not rs.EOF Then
If (i Mod cColumnCount) <0 Then
Response.Write "</td><td>"
Else
Response.Write "</td></tr><td>"
End If
End If
i = i + 1
Loop
%>
</td></tr>
</table>
<%
Function DrawCell(initals, wins)
%>
<div align="center">
<table width="100%" border="1" cellspacing="1" bordercolorlight="#66B2F8"
bordercolordark="#175085">
<tr>
<td width="50" bgcolor="#175085" align="center"><div
align="center"><font face="Georgia" size="2" font color="#FFFFFF">
<b>1<%=intials%></b></div></td>
</tr>
<tr>
<td width="50" bgcolor="#66B2F8" align="center"><div
align="center"><font face="Georgia" size="2" font color="#000000">
<b>1<%=wins%></b></div></td>
</tr</table></div>
<%
End Function
%>

Although I think you could lose the <b><fontand <divelements and use
CSS
styles to tidy this up a lot.
if you refresh the
http://scrimwars.gig-gamers.com/schedule2.asp
you see the result.
Nov 21 '06 #6
This line:
Response.Write "</td></tr><td>"
should ge:
Response.Write "</td></tr><tr><td>"

you close the <tr>, but you dont open the next 'row'.
"Jeff" <gi*****@adelphia.netwrote in message
news:_o******************************@adelphia.com ...
"
>I see. The solution had a flaw if you want to adjust the number of
columns.
The following is better and adjusted to your requirments:-
<table>
<tr><td>
<%
Const cColumnCount = 2
Dim i : i = 1
Dim fldWins : Set fldWins = rs("wins")
Dim fldIntiials : Set fldInitials = rs("clan_initials")
Do Until rs.EOF

DrawCell fldInitials.Value, fldWins.Value

rs.MoveNext

If Not rs.EOF Then
If (i Mod cColumnCount) <0 Then
Response.Write "</td><td>"
Else
Response.Write "</td></tr><td>"
End If
End If
i = i + 1
Loop
%>
</td></tr>
</table>
<%
Function DrawCell(initals, wins)
%>
<div align="center">
<table width="100%" border="1" cellspacing="1" bordercolorlight="#66B2F8"
bordercolordark="#175085">
<tr>
<td width="50" bgcolor="#175085" align="center"><div
align="center"><font face="Georgia" size="2" font color="#FFFFFF">
<b>1<%=intials%></b></div></td>
</tr>
<tr>
<td width="50" bgcolor="#66B2F8" align="center"><div
align="center"><font face="Georgia" size="2" font color="#000000">
<b>1<%=wins%></b></div></td>
</tr</table></div>
<%
End Function
%>

Although I think you could lose the <b><fontand <divelements and use
CSS
styles to tidy this up a lot.
if you refresh the
http://scrimwars.gig-gamers.com/schedule2.asp
you see the result.


Nov 30 '06 #7

"Jeff" <gi*****@adelphia.netwrote in message
news:uK******************************@adelphia.com ...
hey gang. i have a question that is probably simple, and i could do it at
one time, but i forget how.

ok, how to explain

i need to retrieve records from a db. which is no problem. but instead of
displaying them with normal rows, i need to display them across 2 columns,
then down.

here is the example
http://scrimwars.gig-gamers.com/test1.asp

this way, with the sort, i can show 1 and 2 on the same line... 3 and 4 on
the same line and so on.

i know it will have to do with an i MOD, but not sure how to set it up.

can someone get me going here. here is what i have so far.
<%

Set matches1 = Conn.Execute("SELECT clan_initials FROM clans ORDER BY wins
desc")

i = 1
DO UNTIL matches1.EOF

IF NOT i MOD 2 = 0 THEN
opposition = matches1.Fields("clan_initials").Value

%>
not not sure how to set the table up here

thanks for the help guys. i believe i am going with this layout
http://scrimwars.gig-gamers.com/schedule.asp
Dec 6 '06 #8

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

61
by: Toby Austin | last post by:
I'm trying to replace <table>s with <div>s as much as possible. However, I can't figure out how to do the following… <table> <tr> <td valign="top" width="100%">some data that will...
4
by: jeffsal | last post by:
I am using sorttable.js to sort a table which works fine which allows a user to sort the table by clicking on the column header. Is there some code I could add to the page (onload or something) to...
33
by: Geoff Jones | last post by:
Hiya I have a DataTable containing thousands of records. Each record has a primary key field called "ID" and another field called "PRODUCT" I want to retrieve the rows that satisy the following...
6
by: Ward Germonpré | last post by:
Hi, I have a reference to a dom table. How can I retrieve the number of columns in that table ? The stop value below doesn't work, nor did my experimenting with tbodies and childNodes.. .......
8
by: johkar | last post by:
I would like to ensure this script is optimized (runs correctly or does not execute) for the major browsers. Will checking getElementById and getElementsByTagName accomplish this? In addition,...
7
by: Kamal | last post by:
Hello all, I have a very simple html table with collapsible rows and sorting capabilities. The collapsible row is hidden with css rule (display:none). When one clicks in the left of the...
0
by: Romulo NF | last post by:
Greetings again everyone Recently i´ve been asked to develop a script to allow filtering in the content of the table, with dinamic options based on the own content. Example: a table with the name of...
6
by: Romulo NF | last post by:
Greetings again to everyone, Im back to show this grid componenet i´ve developed. With this grid you can show the data like a normal table, remove the rows that you need, add rows, import data,...
1
by: rakeshnair | last post by:
i wrote a code in jsp to create dynamic table..the problem is i need data base connection when cursor moves from one cell to other... eg...when i enter product id in the first cell, the product name...
5
by: jrod11 | last post by:
hi, I found a jquery html table sorting code i have implemented. I am trying to figure out how to edit how many colums there are, but every time i remove code that I think controls how many colums...
0
by: Naresh1 | last post by:
What is WebLogic Admin Training? WebLogic Admin Training is a specialized program designed to equip individuals with the skills and knowledge required to effectively administer and manage Oracle...
0
hi
by: WisdomUfot | last post by:
It's an interesting question you've got about how Gmail hides the HTTP referrer when a link in an email is clicked. While I don't have the specific technical details, Gmail likely implements measures...
1
by: Matthew3360 | last post by:
Hi, I have been trying to connect to a local host using php curl. But I am finding it hard to do this. I am doing the curl get request from my web server and have made sure to enable curl. I get a...
0
by: Carina712 | last post by:
Setting background colors for Excel documents can help to improve the visual appeal of the document and make it easier to read and understand. Background colors can be used to highlight important...
0
BLUEPANDA
by: BLUEPANDA | last post by:
At BluePanda Dev, we're passionate about building high-quality software and sharing our knowledge with the community. That's why we've created a SaaS starter kit that's not only easy to use but also...
0
by: Rahul1995seven | last post by:
Introduction: In the realm of programming languages, Python has emerged as a powerhouse. With its simplicity, versatility, and robustness, Python has gained popularity among beginners and experts...
1
by: ezappsrUS | last post by:
Hi, I wonder if someone knows where I am going wrong below. I have a continuous form and two labels where only one would be visible depending on the checkbox being checked or not. Below is the...
0
by: jack2019x | last post by:
hello, Is there code or static lib for hook swapchain present? I wanna hook dxgi swapchain present for dx11 and dx9.
0
DizelArs
by: DizelArs | last post by:
Hi all) Faced with a problem, element.click() event doesn't work in Safari browser. Tried various tricks like emulating touch event through a function: let clickEvent = new Event('click', {...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.