This script by Rob Sossomon works great --Thanks!
however could anyone tell me if its possible to make it run horizontally. at
the moment the output is like this---

----------------------------------------------
      Round Game Winning team Wins
      1 1 Collingwood
      1 2 Melbourne 4
      1 3 Fremantle  4
      1 4 Brisbane 4
      1 5 St Kilda
      1 6 Port Adelaide 4
      1 7 Kangaroos 4
      1 8 West Coast  4
      2 1 Richmond
      2 2 Collingwood 4
      2 3 Brisbane 4
      2 4 West Coast
      2 5 Essendon
      2 6 Fremantle
      2 7 Carlton 4
      2 8 Hawthorn

----------------------------------------------------------I would like it
like this
Round          game1        win        game2     win       game3     etc

   1           Collingwood   4      Melbourne     4         Fremantle 4


<?php
session_start();
include("connect.php");
$Name = $_SESSION['first_name'] . " " . $_SESSION['last_name'];

$sql = "SELECT * FROM Selections WHERE Name = '$Name'";
$result = mysql_query($sql);

/* Determine the number of records returned */
while ($row = MYSQL_FETCH_array($result))
$number = mysql_numrows($result);


/* Start printing to make it look good */
print "<table width=\"30%\" cellspacing=\"0\" cellpadding=\"0\"
border=\"0\">";
print
"<tr><th>Round....</th><th>Game....</th><th>Winning
Team....</th><th>Wins</th></tr>";

$total_points=0;
/* Iterate through to make it clean */
while ($i < $number)
{
 $item_1 = mysql_result($result, $i,"Round");
 $item_2 = mysql_result($result, $i,"Game");
 $item_4 = mysql_result($result, $i,"Winner");
 $item_5 = mysql_result($result, $i,"Points");

/* This makes it print out in 2 separate color, depending on rows. */
 if ($i%8 == 0)
 {
  print "<tr
bgcolor=\"#999999\"><td><center>$item_1</center></td><td><center>$item_2</ce
nter></td><td><center>$item_4</center></td><td><center>$item_5</center></td>
</tr>\n";
 }
 else
 {
 print "<tr
bgcolor=\"#666666\"><td><center>$item_1</center></td><td><center>$item_2</ce
nter></td><td><center>$item_4</center></td><td><center>$item_5</center></td>
</tr>\n";
 }



/* Increase record count and total_points to date */
 $i++;
 $total_points += $item_5;
}
/* close everything up */

 print "<tr><th colspan=5>Total Points Earned: $total_points</th></tr>";
 print "</table>";

?>

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

Reply via email to