Web Wiz - Green Windows Web Hosting

  New Posts New Posts RSS Feed - Display data horizontally!
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

Display data horizontally!

 Post Reply Post Reply
Author
xavier View Drop Down
Groupie
Groupie


Joined: 23 December 2004
Status: Offline
Points: 50
Post Options Post Options   Thanks (0) Thanks(0)   Quote xavier Quote  Post ReplyReply Direct Link To This Post Topic: Display data horizontally!
    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
Back to Top
michael View Drop Down
Senior Member
Senior Member
Avatar

Joined: 08 April 2002
Location: United States
Status: Offline
Points: 4670
Post Options Post Options   Thanks (0) Thanks(0)   Quote michael Quote  Post ReplyReply Direct Link To This Post 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
Back to Top
bootcom View Drop Down
Senior Member
Senior Member
Avatar

Joined: 26 February 2005
Location: United Kingdom
Status: Offline
Points: 259
Post Options Post Options   Thanks (0) Thanks(0)   Quote bootcom Quote  Post ReplyReply Direct Link To This Post 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
 
Back to Top
xavier View Drop Down
Groupie
Groupie


Joined: 23 December 2004
Status: Offline
Points: 50
Post Options Post Options   Thanks (0) Thanks(0)   Quote xavier Quote  Post ReplyReply Direct Link To This Post Posted: 24 June 2005 at 7:20am
i'm grateful guyz!
onError GoTo Hell
Back to Top
dpyers View Drop Down
Senior Member
Senior Member


Joined: 12 May 2003
Status: Offline
Points: 3937
Post Options Post Options   Thanks (0) Thanks(0)   Quote dpyers Quote  Post ReplyReply Direct Link To This Post 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.


Edited by dpyers - 24 June 2005 at 10:43am

Lead me not into temptation... I know the short cut, follow me.
Back to Top
ub3rl337ch3ch View Drop Down
Senior Member
Senior Member
Avatar

Joined: 16 February 2005
Location: Australia
Status: Offline
Points: 341
Post Options Post Options   Thanks (0) Thanks(0)   Quote ub3rl337ch3ch Quote  Post ReplyReply Direct Link To This Post 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...
Back to Top
 Post Reply Post Reply

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.08
Copyright ©2001-2026 Web Wiz Ltd.


Become a Fan on Facebook Follow us on X Connect with us on LinkedIn Web Wiz Blogs
About Web Wiz | Contact Web Wiz | Terms & Conditions | Cookies | Privacy Notice

Web Wiz is the trading name of Web Wiz Ltd. Company registration No. 05977755. Registered in England and Wales.
Registered office: Web Wiz Ltd, Unit 18, The Glenmore Centre, Fancy Road, Poole, Dorset, BH12 4FB, UK.

Prices exclude VAT at 20% unless otherwise stated. VAT No. GB988999105 - $, € prices shown as a guideline only.

Copyright ©2001-2026 Web Wiz Ltd. All rights reserved.