1

I have a form that assigns players to events. The form basically has player names with a check box next to their name. I can have up to a couple thousand players that I can pick from. when checking the boxes, anyone in the first half'ish of the list gets updated, but anyone toward the bottom'ish half does not. I can choose no one in the first half and still no one in the bottom half will get inserted. Does does php or MySQL have a maximum number of iterations they'll go through before stopping?

This is what creates the form

$query5 = " SELECT p.playerID, p.stateID, p.firstName, p.lastName, p.city, p.divisionID FROM registered_player p WHERE p.divisionID=2 ORDER BY p.lastName ASC ";
    $result5 = mysql_query($query5) or die ("Error in query: $query5. " . mysql_error());
    ?>

        <?php 
        $i=1;
        while ( $row5= mysql_fetch_array($result5)){extract($row5);
                $query7 = " SELECT stateAbbr FROM state WHERE stateID='$stateID'";
                $result7 = mysql_query($query7) or die ("Error in query: $query7. " . mysql_error());
                $row7= mysql_fetch_array($result7);
                extract($row7);
                $trpID = $row5['playerID'];
                    $queryq = "SELECT playerID FROM tn_participants WHERE playerID='$trpID' AND tourneyID='$tourneyID'";
                    $resultq = mysql_query($queryq) or die ("Error in query: $queryq. " . mysql_error());
                    $numRowsq = mysql_num_rows($resultq);
                    if($numRowsq > 0) {
                                $option = "<input type='checkbox' name='playerID[2][]' size='1' value='$playerID' checked>$lastName, $firstName - $city,$stateAbbr <br>
                                            <input type='hidden' name='tourneyID[2][]' value='$tID'><input type='hidden' name='divisionID[2][]' value='2'>";
                            } else {
                                $option = "<input type='checkbox' name='playerID[2][]' size='1' value='$playerID'>$lastName, $firstName - $city,$stateAbbr <br>
                                            <input type='hidden' name='tourneyID[2][]' value='$tID'><input type='hidden' name='divisionID[2][]' value='2'>";
                            }
                echo  "$option ";
                $i++;}

this is the code that does the inserting

$tID = $_GET['tourneyID'];


$query2 = "DELETE from tn_participants where tourneyID='$tID' AND divisionID=1";
$result2 = mysql_query($query2) or die ("Error in query: $query2. " . mysql_error());

foreach($_POST['playerID'] as $plID => $value) {
foreach($value as $key => $blah) {
    $tID=$_POST['tourneyID'][$plID][$key];
    $dID=$_POST['divisionID'][$plID][$key];
    $pID=$_POST['playerID'][$plID][$key];
    $query = "INSERT INTO tn_participants (tourneyID, divisionID, playerID)
                    VALUES ('$tID', '$dID', '$pID')";
    $result = mysql_query($query) or die ("Error in query: $query. " . mysql_error());

    }
}

1 Answers1

0

The post/get variables have a memory limit which cannot be overcome. I am not sure offhand what the memory limit is exactly. You will need a 'plan b' (. Maybe use jquery to update each field as you tick then using ajax as an example of a work around)

[Edit] Actualy I remembered you can expand the memory limit if your service provider allows. This question refers.

Community
  • 1
  • 1
Gavin Simpson
  • 2,766
  • 3
  • 30
  • 39