maestrog Posted March 30, 2008 Share Posted March 30, 2008 I have a tablerow "master" which contains the winners of the games in the final four basketball tourny. All the player pics are rows after the master. I want to loop through the players rows and if == to the master field..add 2 points to mpts which is the last field in the division. My +=2 operation is returning 222222222 for starters. I am all loooped out. Please help. $resultm = mysql_query("SELECT name, m1, m2, m3, m4, m5, m6, m7, mate, mpts FROM $table_name"); $resultmaster = mysql_query("SELECT name, m1, m2, m3, m4, m5, m6, m7, mate, mpts FROM $table_name WHERE name = 'master'");//midwest division-first round $num = mysql_num_rows($resultm); $rowm = mysql_fetch_array($resultmaster, MYSQL_ASSOC); $res = count($rowm); //$mid = "UPDATE $table_name SET //mpts = '$row[10]' WHERE id = '2'"; //$put = @mysql_query($mid,$connection) or die(mysql_error()); while($row = mysql_fetch_array($resultm, MYSQL_ASSOC)) { for ($counter=1; $counter<$num; $counter++) { //echo "{$row[name]}, {$row[m1]}, {$row[m2]}, {$row[m3]}, {$row[m4]}, {$row[m5]}, {$row[m6]}, {$row[m7]}, {$row[mate]} <br><br>"; for ($count=1; $count<10; $count++) { if ($row[$count] == $rowm[$count]) { $row[10] =+ 2; //$put; echo $row[10]; } } } } //Thanks from the maestro! Link to comment https://forums.phpfreaks.com/topic/98621-for-loop-problems-with-final-four-tournament/ Share on other sites More sharing options...
ucffool Posted March 30, 2008 Share Posted March 30, 2008 $row[10] =+ 2; Should be += as you said. Past that, I am just posting because trying to follow all your loops is really hard with the current formatting. Link to comment https://forums.phpfreaks.com/topic/98621-for-loop-problems-with-final-four-tournament/#findComment-504752 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.