I solved it and you can too. But, like all things complicated, you have to go through some gyrations. Below, I refer to columns of data. The left columns of data in this example holds a date, time, site...etc starting with the very first record in the table. The right column has the same structure, except that it printed from the records starting midway through the total number of records in the table. Hence the information is sorted vertically respective to its total columns.
- Determine the number of rows in a table. You will need to divide that number by two for two columns of data.
$sql_1 = mysql_query("SELECT * FROM games WHERE division ='$whatDiv' ORDER BY date, time, field ");
$num_rows = mysql_num_rows($sql_1);
$half_num = ($num_rows/2);
If you are going to display the data in a table, this method requires that you put the html table commands into a variable. I used $td_open and and $td_closed
//set up table commands so that I can stick them into string
$td_open = "<" ."td" . ">"; //"<td></td>". "<" ."/td" . ">";
$td_close = "<" ."/td" . ">";
load your record's fields into an array
$dayOfWeek = date('D', strtotime($row['date']));
$thisGame[] = $dayOfWeek." ". easyDateRead($row['date']).$td_open . $timeMe . $td_close . $td_open . getSiteName($row['site']). $td_close . $td_open .$row['field']. $td_close . $td_open .$row['team1']. $td_close . $td_open .$row['team2'];
- After all the data is loaded, you'll need to print it out. Here's the table. Note that there are two counters. $i is for the left columns of data and $j is for the right columns of data. The table prints like all tables do, horizontally, but the first array starts at the beginning of the data (record 0) and $j starts at the middle (the record number half way through the table's records).
print "<table border = 1>";
print "<tr bgcolor='#99FFCC'><td>DATE</td><td>TIME</td><td>SITE</td><td>FIELD #</td><td>HOME</td><td>AWAY</td><td>DATE</td><td>TIME</td><td>SITE</td><td>FIELD #</td><td>HOME</td><td>AWAY</td></tr>";
while ($i < $half_num)
{
print "<tr><td>" . $thisGame[$i]. "</td><td>" . $thisGame[$j]. "</tr>";
$i++; $j++;
}
print "</table>";
And that's it. Have fun.