RE: [PHP] Table Making

2002-07-11 Thread Jason Soza
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: Re: [PHP] Table

Re: [PHP] Table Making

2002-07-11 Thread Tyler Longren
Subject: Re: [PHP] Table Making 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 table width

Re: [PHP] Table Making

2002-07-11 Thread Chris Hewitt
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

Re: [PHP] Table Making

2002-07-11 Thread Justin French
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

RE: [PHP] Table Making

2002-07-11 Thread joakim . andersson
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

Re: [PHP] Table Making

2002-07-11 Thread Analysis Solutions
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 than

Re: [PHP] Table Making

2002-07-11 Thread Analysis Solutions
On Thu, Jul 11, 2002 at 11:14:51AM -0400, Analysis Solutions wrote: echo ' td'; if ( mysql_fetch_seek($Result, $Index) ) { $row = mysql_fetch_row($Result); echo $row[0]; } else { echo 'nbsp;'; } OOPS! I forgot to close the table cell.

Re: [PHP] Table Making

2002-07-11 Thread Jason Soza
/table\n; //end table on $i = 5 } $i+5; $grad_year=; //clear $grad_year } if ($i5) print /table\n; //end any rows with less than 5 columns Jason Soza - Original Message - From: Justin French [EMAIL PROTECTED] Date: Thursday, July 11, 2002 3:48 am Subject: Re: [PHP] Table

Re: [PHP] Table Making

2002-07-11 Thread Chris Boget
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

Re: [PHP] Table Making

2002-07-11 Thread Chris Boget
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?)

Re: [PHP] Table Making

2002-07-11 Thread Jason Soza
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 Subject: Re: [PHP] Table

Re: [PHP] Table Making

2002-07-10 Thread Analysis Solutions
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 table width=\100%\ border=\0\ align=\center\\n;

RE: [PHP] Table Making

2002-07-10 Thread Martin Towell
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