|
-
Sep 10th, 2000, 05:16 AM
#1
Thread Starter
Junior Member
I want to display data from arrays in neat rows and columns in a browser. Tables just keep getting messed up.
I used the 'sprintf' function to format the data padding with spaces as necessary.
$result = sprintf("%-25s,%-10s,%-15s,%-5s,%-20s,%-20s,%-10s\n", $fields[0], $fields[1], $fields[2], $fields[3], $fields[4], $fields[5]);
But HTML does not display more that 1 space.
How do I get the display I want?
I tried replacing the space with ' ' but without success.
Any help would be appreciated.
Peter Brown
-
Sep 10th, 2000, 05:35 AM
#2
Monday Morning Lunatic
I refuse to tie my hands behind my back and hear somebody say "Bend Over, Boy, Because You Have It Coming To You".
-- Linus Torvalds
-
Sep 10th, 2000, 08:43 AM
#3
Thread Starter
Junior Member
I tried tables first. But the data is of variable length so all that happened is that the columns in different rows were in different places, a right mess! I was looking for something consistant.
-
Sep 10th, 2000, 09:08 AM
#4
Monday Morning Lunatic
What do you mean, they were in different places? In HTML if you don't specify a size the column takes its width from the largest object (depending on sizes of other columns and maximum table width).
I refuse to tie my hands behind my back and hear somebody say "Bend Over, Boy, Because You Have It Coming To You".
-- Linus Torvalds
-
Sep 10th, 2000, 12:08 PM
#5
Thread Starter
Junior Member
I did specify the column widths, but this did not solve the problem. I had thought that specifying the width would 'fix' the width but this does not happen. If you try to put more text in one column than would fit then the column expands to suit the text. So if you have varying amounts of text in corresponding columns in different rows the columns do not line up. This is what I am trying to get round.
-
Sep 10th, 2000, 02:07 PM
#6
Monday Morning Lunatic
What do they not line up with? Are you using one table with lots of rows, or lots of tables? I am really confused here .
I refuse to tie my hands behind my back and hear somebody say "Bend Over, Boy, Because You Have It Coming To You".
-- Linus Torvalds
-
Sep 13th, 2000, 01:20 PM
#7
Thread Starter
Junior Member
OPPS, problem solved. Yes HTML tables are the way.
What I intended was one table with lots of rows. What I coded was lots of tables with one row - BIG MISTAKE !! Put some wrong bits inside the loop.
I now have one table with lots of rows, just what I wanted.
Thanks for the trouble in replying.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|