28. april 2004 - 15:00Der er
12 kommentarer og 1 løsning
Newb - Deling af tabel?
Hey! Jeg har sådan et kald fra en db og et loop... Men jeg ville gerne gøre det sådan så den blev delt op i 2 rækker med 3 i hver... Kan i hjælpe mig med det? Mit loop ser sådan her ud:
<table border="0" cellpadding="0" cellspacing="0"> <% SQL = "SELECT * FROM typer" Set rs = conn.Execute(SQL)
<table border="0" cellpadding="0" cellspacing="0"> <% SQL = "SELECT * FROM typer" Set rs = conn.Execute(SQL)
antalPrRaekke = 0 DO WHILE NOT rs.EOF
typeID = RS("id") tur = RS("type") pic = RS("pic")
if antalPrRaekke = 0 then %> <tr> <% end if %> <td width="15"> </td> <td height="80" width="104" align="left"><img border=1 height="75" width="100" src="images/<%=pic%>"></td> <td height="80"><a href="arrangement.asp?turtype=<%= typeID %>"><%= tur %></a></td> if antalPrRaekke = 3 then </tr> <% antalPrRaekke = 0 end if if antalPrRaekke < 3 then %> </tr> %> end if antalPrRaekke = antalPrRaekke + 1 rs.MoveNext LOOP RS.Close Set SQL = nothing %> </table>
antalPrRaekke = antalPrRaekke + 1 if antalPrRaekke = 3 then response.write "</tr>" antalPrRaekke = 0 end if rs.MoveNext loop if antalPrRaekke < 3 then response.write "</tr>" end if RS.Close Set SQL = nothing %> </table>
og 3 tallet i "if antalPrRaekke = 3 then" udskifter du bare med det antal du vil have per raekke.
Synes godt om
Ny brugerNybegynder
Din løsning...
Tilladte BB-code-tags: [b]fed[/b] [i]kursiv[/i] [u]understreget[/u] Web- og emailadresser omdannes automatisk til links. Der sættes "nofollow" på alle links.