Print Page | Close Window

Display data horizontally!

Printed From: Web Wiz Forums
Category: General Discussion
Forum Name: Classic ASP Discussion
Forum Description: Discussion on Active Server Pages (Classic ASP).
URL: https://forums.webwiz.net/forum_posts.asp?TID=15562
Printed Date: 30 March 2026 at 3:26am
Software Version: Web Wiz Forums 12.08 - https://www.webwizforums.com


Topic: Display data horizontally!
Posted By: xavier
Subject: Display data horizontally!
Date Posted: 23 June 2005 at 10:44am
hi guyz,
 
i really have to thank you the way u solved my other prob
 
but this
 
if you want your data display horizontally data output from database
 
for example
SmileSmileSmile
this 3 smileys are assumed to be generated from the database after those 3 you want another then another like this
 
SmileSmileSmile
SmileSmileSmile
SmileSmileSmile
 
how do u come about it
 
thanks


-------------
onError GoTo Hell



Replies:
Posted By: michael
Date Posted: 23 June 2005 at 4:49pm
Dim myCounter as integer
myCounter = 1
While not rs.EOF
 Response.Write (rs("yourfield"))
 If myCounter = 3 THEN Response.Write("<br/>")
 myCounter = myCounter + 1
Next
 
just a simple example, but hope you get the idea


-------------
http://baumannphoto.com" rel="nofollow - Blog | http://mpgtracker.com" rel="nofollow - MPG Tracker


Posted By: bootcom
Date Posted: 24 June 2005 at 4:59am
If you have more than 6 items though you are only going to have one line break. To get a line break every 3 items, I would personally suggest using the following method:
 

Dim myCount
 
' Initialise the counter
myCount = 0
 
Do while not rsCommon.eof
 
response.write("field_name")
 
' Now if the my count variable can be wholly divisible by 3 then
' write a line break.
If myCount MOD 3 = 0 then response.write("<br>")
 
' Increment the counter by 1
myCount = myCount + 1
 
rsCommon.movenext
loop
 


Posted By: xavier
Date Posted: 24 June 2005 at 7:20am
i'm grateful guyz!

-------------
onError GoTo Hell


Posted By: dpyers
Date Posted: 24 June 2005 at 10:39am
You might also want to add
response.write "<br/>"
after the line with the loop statement.

This would put a line break after the last line if the line only had 1 ot 2 images in it. You'd wind up with a double line break though if the last line was divisible by 3.


-------------

Lead me not into temptation... I know the short cut, follow me.


Posted By: ub3rl337ch3ch
Date Posted: 26 June 2005 at 7:16pm
then after the loop you just do
 
if mycount MOD 3 <> 0 then
response.write "<br/>"
end if
 
that gives you a line break after the last data has been written, and you won't get two linbreaks if mycount is a multple of 3...



Print Page | Close Window

Forum Software by Web Wiz Forums® version 12.08 - https://www.webwizforums.com
Copyright ©2001-2026 Web Wiz Ltd. - https://www.webwiz.net