Jump to content

for loop problems with final four tournament


maestrog

Recommended Posts

   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!

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.