Well, wouldn't that print a table with one row containing the results?

Again, what I'm looking for is a vertically laid-out table. So instead 
of:
1 2 3 4 5
6 7 8 9 10
11 12 13 14 15

I want:
1 6 11
2 7 12
3 8 13
4 9 14
5 10 15

To give you an idea of why I want this, check out www.jdhsgrads.com - 
this is the site I'm currently working on. When you see the list of 
graduation years, your eye (well, at least mine) wants to follow the 
dates top to bottom, left to right. As it is now, you have to work to 
see the progression and find out where you want to go to locate a 
specific date.

I'm hoping the code I posted will create something like:
<table>
<tr>
<td>
    <table>
    <tr><td>1941</td></tr>
    <tr><td>1942</td></tr>
    <tr><td>1943</td></tr>
    </table>
</td>
<td>
    <table>
    ...

Make sense?

Jason Soza

----- Original Message -----
From: "Lazor, Ed" <[EMAIL PROTECTED]>
Date: Thursday, July 11, 2002 2:08 pm
Subject: RE: [PHP] Re: Table Making

> Will this work for you?
> 
>       $numFields = mysql_num_fields($Results);
>       
>       print "<table>";
>       while ($Row = mysql_fetch_array($Results))
>       {
>               print "<tr>";
>               for ($i = 0; $ < $numFields; $i++)
>                       print "<td>".$Row[$i]."</td>";
>               print "</tr>";
>       }
>       print "</table>";
> 
> 
> 
> -----Original Message-----
> I was wondering if the following might work:
> 
> $cells = 10; //set desired number of cells per column
> $numRows = mysql_num_rows($result); //determine number of rows
> $numCols = ceil($numRows/$cells); //determine number of columns needed
> 
> print "<center><table width=\"100%\" border=\"0\" 
> cellpadding=\"0\" 
> cellspacing=\"0\">\n"; //start main table
> 
> for($i=0; $i<$numCols; $i++) { 
> 
> echo "<tr><td align=\"center\">\n"; //setup main row/cell
> 
> echo "<table border=\"0\" cellpadding=\"0\" cellspacing=\"0
> \">\n"; //setup secondary table
> 
>       while($dataArray = mysql_fetch_array($result)) { //print 
> results of SQL in secondary table
>               extract($dataArray);
>               $n++;
>               
>               printf("<tr>\n<td align=\"center\" 
> valign=\"center\">href=\"year.asp?year=%\">%s</td>\n</tr>", 
$grad_year, $grad_year);
> 
>               if ($n==$cols) {
>                       echo "</table>"\n; //close secondary table at 
> 10 cells
>                       }  
> 
> echo "</td></tr>\n"; //close main row/cell
> 
> }
> 
> echo "</table>\n"; //close main table


-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to