table rows
am 21.11.2006 03:53:24 von jeff
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
Re: table rows
am 21.11.2006 09:51:10 von exjxw.hannivoort
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 "
"
DO UNTIL matches1.EOF
if newRow then response.write ""
newRow = not newRow
response.write "" & matches1("fieldname")
matches1.MoveNext
Loop
if not newRow then response.write " | "
response.write " |
"
not tested
--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)
Re: table rows
am 21.11.2006 10:13:39 von Anthony Jones
"Jeff" wrote in message
news:uKydnfrfNMp89P_YnZ2dnUVZ_oidnZ2d@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.
Re: table rows
am 21.11.2006 15:15:28 von jeff
"Anthony Jones" wrote in message
news:OSUY50UDHHA.3444@TK2MSFTNGP04.phx.gbl...
>
> "Jeff" wrote in message
> news:uKydnfrfNMp89P_YnZ2dnUVZ_oidnZ2d@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")
%>
bordercolor="#000000" id="AutoNumber1" width="58">
<%
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
%>
bordercolordark="#175085">
align="center">
1<%=t1%> |
align="center">
1<%=w1%> |
|
<% ELSE %>
bordercolordark="#175085">
align="center">
1<%=t1%> |
align="center">
1<%=w1%> |
|
<%
END IF
i = i + 1
teams.MoveNext
LOOP
%>
|
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.
Re: table rows
am 21.11.2006 17:00:52 von Anthony Jones
"Jeff" wrote in message
news:saKdnYbRlpBRlP7YnZ2dnUVZ_u2dnZ2d@adelphia.com...
>
> "Anthony Jones" wrote in message
> news:OSUY50UDHHA.3444@TK2MSFTNGP04.phx.gbl...
> >
> > "Jeff" wrote in message
> > news:uKydnfrfNMp89P_YnZ2dnUVZ_oidnZ2d@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")
> %>
>
>
>
>
> bordercolor="#000000" id="AutoNumber1" width="58">
>
>
> <%
> 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
> %>
>
>
>
> bordercolordark="#175085">
>
>
> align="center">
> 1<%=t1%> |
>
>
>
> align="center">
> 1<%=w1%> |
> |
> <% ELSE %>
>
>
>
> bordercolordark="#175085">
>
>
> align="center">
> 1<%=t1%> |
>
>
>
> align="center">
> 1<%=w1%> |
> |
>
> <%
> END IF
> i = i + 1
> teams.MoveNext
> LOOP
> %>
> |
>
>
> 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:-
<%
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 " | "
Else
Response.Write " |
"
End If
End If
i = i + 1
Loop
%>
|
<%
Function DrawCell(initals, wins)
%>
bordercolordark="#175085">
align="center">
1<%=intials%> |
align="center">
1<%=wins%> |
<%
End Function
%>
Although I think you could lose the and elements and use CSS
styles to tidy this up a lot.
Re: table rows
am 21.11.2006 17:29:08 von jeff
"
> 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:-
>
>
>
>
> <%
> 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 " | "
> Else
> Response.Write " |
"
> End If
> End If
> i = i + 1
> Loop
> %>
> |
>
>
>
> <%
> Function DrawCell(initals, wins)
> %>
>
>
> bordercolordark="#175085">
>
>
> align="center">
> 1<%=intials%> |
>
>
>
> align="center">
> 1<%=wins%> |
>
> <%
> End Function
> %>
>
> Although I think you could lose the and elements 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.
Re: table rows
am 01.12.2006 00:36:58 von Cozmo
This line:
Response.Write "
"
should ge:
Response.Write " | "
you close the |
, but you dont open the next 'row'.
"Jeff" wrote in message
news:_oqdnQjsmJGitP7YnZ2dnUVZ_hydnZ2d@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:-
>>
>>
>>
>>
>> <%
>> 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 " | "
>> Else
>> Response.Write " |
"
>> End If
>> End If
>> i = i + 1
>> Loop
>> %>
>> |
>>
>>
>>
>> <%
>> Function DrawCell(initals, wins)
>> %>
>>
>>
>> bordercolordark="#175085">
>>
>>
>> align="center">
>> 1<%=intials%> |
>>
>>
>>
>> align="center">
>> 1<%=wins%> |
>>
>> <%
>> End Function
>> %>
>>
>> Although I think you could lose the and elements 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.
>
>
Re: table rows
am 06.12.2006 14:55:52 von jeff
"Jeff" wrote in message
news:uKydnfrfNMp89P_YnZ2dnUVZ_oidnZ2d@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