This is exactly what I was looking for. Now I wish I could just leave
work now to test it out!
Thanks everyone for your help on this, very appreciated!
Jason Soza
- Original Message -
From: "Chris Boget" <[EMAIL PROTECTED]>
Date: Thursday, July 11, 2002 9:05 am
S
> be, but in my head it seems like it would work. Basically, what if the
> while() printed multiple tables? In each table it made 5 rows, each row
> with one cell in it, so it would then be vertical. I'm just not sure
> how to incorporate into the loop (maybe a for() loop is better for
> this?
> Like I said, I shudder at the thought of how much this would load the server
> (especially on large rows (lots of fields) or large tables (lots of rows =
> lots of queries)), but if the layout is imperative, then maybe this is an
> option...
No load whatsoever. You just need to think about how
print "\n"; //end table on $i = 5
}
$i+5;
$grad_year=""; //clear $grad_year
}
if ($i<5) print "\n"; //end any rows with less than 5 columns
Jason Soza
- Original Message -
From: Justin French <[EMAIL PROTECTED]>
Date: Thur
On Thu, Jul 11, 2002 at 11:14:51AM -0400, Analysis & Solutions wrote:
> echo ' ';
> if ( mysql_fetch_seek($Result, $Index) ) {
> $row = mysql_fetch_row($Result);
> echo $row[0];
> } else {
> echo ' ';
> }
OOPS! I forgot to close the table cell.
On Thu, Jul 11, 2002 at 03:14:07PM +0200, [EMAIL PROTECTED] wrote:
>
> Another way of doing it is to use mysql_data_seek() to jump back and forth
> in the result set.
Now that Jason clarified what he's trying to do, Joakim is on target.
Since this data set already exists, I'd do this rather th
This is one way of doing it:
- calculate how many rows are needed given the total number of records
(mysql_num_rows()) and how many columns you want.
- loop through all records and store them in a two-dimensional array
starting at arr[0][0] to arr[maxrows][0] and then increment the 'column' and
s
I hate to think what sort of a burden this would place on ther server,
but...
You could always find out how many rows there are, then run individual
queries for each cell of the table. In other words, to achieve this layout:
1 4 7
2 5 8
3 6 9
You would do queries in this order:
1
4
7
2
5
8
3
Jason,
HTML tables will always be displayed left to right, top to bottom. This
is why you should ensure that the data from your database table comes
out in the right order. Use an ORDER BY clause in your SELECT statement.
Designing the table layout to be suitable avoids the problem you
curren
age-
> From: Analysis & Solutions [mailto:[EMAIL PROTECTED]]
> Sent: Wednesday, July 10, 2002 10:13 PM
> To: PHP List
> Subject: Re: [PHP] Table Making
>
>
> Jason:
>
> On Wed, Jul 10, 2002 at 10:04:45PM -0800, Jason Soza wrote:
> >
> > I have
3 4 5
6 7 8 9 10
11 12 13 14 15
I want this:
1 6 11
2 7 12
3 8 13
4 9 14
5 10 15
Thanks again for the help, though.
Jason Soza
-Original Message-
From: Analysis & Solutions [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, July 10, 2002 10:13 PM
To: PHP List
Subject: R
This is the logic I would use
count number of results
table rows = num results / 5(maybe floor() or ceil() it)
read results into a 2D array
fill column 1 first
when column 1 fills up, reset row count to 0 and inc. col count
whizz through your array and display the table as needed
HTH
Mar
Jason:
On Wed, Jul 10, 2002 at 10:04:45PM -0800, Jason Soza wrote:
>
> I have this nice piece of code to take my SQL result and organize it into a
> nice 5 column table:
Nice is in the eye of the beholder... Here's what I think is nice:
echo "\n";
echo " \n";
while ($row = mysql_fetch_
13 matches
Mail list logo