When you run this script, or one like it, does it work? You seem to be missing a number of brackets. For example, you have:
while ($row = MYSQL_FETCH_ROW($result)) instead of while ($row = MYSQL_FETCH_ROW($result)) { or while ($row = MYSQL_FETCH_ROW($result)) { > [Original Message] > From: Robert Sossomon <[EMAIL PROTECTED]> > To: BigMark <[EMAIL PROTECTED]> > Cc: <[EMAIL PROTECTED]> > Date: 06/03/2004 11:44:58 PM > Subject: Re: [PHP] select from db > > <!SNIP> > > table name 'Selections' > > > > (rows) Round Game Name Winner Points > > data eg 1 1 mark Hawthorn 4 > > (if team is a winner then 4 points added) > > > > 1 2 mark Geelong 0 > > > <! End Snip> > > Assuming you have them submit a form to get here: > <?php > //somefilename > > //Access your Database > include "db.php"; > > //Name from previous form, or you can use from authentication, > //whichever, just mod the code to reflect where getting it from > $name = $_POST[name]; > > //query and results > $query = "select * from Selections where Name='$name'"; > $result = mysql_query($query); > > /* Determine the number of records returned */ > while ($row = MYSQL_FETCH_ROW($result)) > $number = mysql_numrows($result); > > /* Start printing to make it look good */ > print "<table cellspacing=\"0\" cellpadding=\"5\" border=\"1\">"; > print > "<tr><th>Round</th><th>Game</th><th>Name</th><th>Winner</th><th>Points</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_3 = mysql_result($result, $i,"Name"); > $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%2 == 0) > { > print "<tr > bgcolor=\"#eeeeee\"><td>$item_1</td><td>$item_2</td><td>$item_3</td><td>$ite m_4</td><td>$item_5</td></tr>\n"; > } > else > { > print "<tr > bgcolor=\"#ffffff\"><td>$item_1</td><td>$item_2</td><td>$item_3</td><td>$ite m_4</td><td>$item_5</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 -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php