|
|
|||||||||
|
|||||||||
|
|||||||||
| |
|||
| ||||||||||||||||||||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
Hello,
How r u? I have one difficulty.I want to show records in 3 column from data base. how can i do this.? actually i want to show records in row and column. but want to show records on conditions. when i run this code it show all records in one column. i want to show records in three(3) column <!--#INCLUDE file="connection.asp" --> <% dim sql %> <HTML> <HEAD><TITLE>Welcome...</TITLE> </HEAD> <BODY> <table border="0" align=left> <% rs.Open "select * from accesseries",cn dim a,b,c,d,e,f while not rs.EOF a = rs.Fields ("companyname").Value b = rs.Fields ("PBox").Value c = rs.Fields ("telno").Value d = rs.Fields ("faxno").Value e = rs.Fields ("email").Value f = rs.Fields ("email").Value %> <tr> <td><h3><font color="#FFCC33"> <%response.Write (a)%></font></h3></td></tr> <tr><td><font color="black"><h4><b> <%=b%> </b></h4></font></td></tr> <tr><td><font color="black"> <%="P.O.Box: "%><%=c%> </font></td></tr> <tr><td><font color="black"> <%="Phone: "%><%=d%> </font></td></tr> <tr><td><font color="black"> <%="Fax: "%><%=e%> </font></td></tr> <tr><td><font color="black"> <%="E mail: "%><%=f%> </font></td></tr> <%rs.MoveNext wend %> </table> </BODY></HTML> |
|
#2
|
|||
|
|||
|
You have defined your html table as one cell rows:
Try this instead: Code:
<% While Not rs.EOF%> <tr><td><% = a%></td> <td><% = b%></td> etc.... <td><% = f%></td></tr> <% rs.MoveNext Wend%> This will make the one row per record. Hope this helps
__________________
- Rogier Doekes |
|
#3
|
||||
|
||||
|
"<td>...</td>" defines a cell
"<tr>...</tr>" defines a row e.g. a three columned row would look like this (with correct formatting): Code:
<tr> <td>...</td> <td>...</td> <td>...</td> </tr> ... repeat |
|
#4
|
|||
|
|||
|
Dear,You can't understand my Question I want to show records
in ist row just 4 records.5th records must show in 2nd column. as it is 4 records in 2nd column.and 9th record must show in 3rd column. and so on.......... Please help me in this matter. |
|
#5
|
|||
|
|||
|
The way HTML tables are built is row by row. What you are asking is to first build 4 rows in one column and then move on to the next columns. I believe you can do this with nesting tables and a row counter.
Code:
<table>
<tr "valign="top">
<td>
<% intcounter = 1
While Not rs.EOF
If intCounter MOD 4 = 1 Then %>
<table>
<% end if%>
<tr valign="top">
<td><% = a%></td>
<td><% = b%></td> etc...
</tr>
<% if IntCounter MOD 4 = 0 Then%>
</table>
</td>
<td>
<% end if
rs.MoveNext
intCounter = intCounter + 1
Wend
If IntCounter MOD 4 <> 1 Then
%>
</table>
<% End If%>
</td>
</tr>
</table>
You might have to tweak this a little bit, I have not tested this. Play around with the MOD 4 = xx a little bit to get you the desired results. Hope this helps |
|
#6
|
|||
|
|||
|
Bundle of thanks friend,
i have tried it now it is working perfectly. thanks again. TAKE CARE. bye. ZAHID. |
![]() |
| Viewing: Dev Articles Community Forums > Programming > ASP Development > How can we show record from data base in tables (3) column |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|