rendered paste body mysql_selectdb("rcdaly_spacegame", $linkID); $ship_query3 = mysql_query("SELECT ship1_total, ship2_total, ship3_total, " . "ship4_total, ship5_total, ship6_total, ship7_total, ship8_total, " . "ship9_total, ship10_total FROM reinforcements WHERE for_station_id='" . $station_id . "'", $linkID); $num_reinf_fleets = 0; // initialize for ($x = 1; $x <= mysql_num_rows($ship_query3); $x++) { $row = mysql_fetch_assoc($ship_query3); $temp_ship1_total = $row[ship1_total]; $temp_ship2_total = $row[ship2_total]; $temp_ship3_total = $row[ship3_total]; $temp_ship4_total = $row[ship4_total]; $temp_ship5_total = $row[ship5_total]; $temp_ship6_total = $row[ship6_total]; $temp_ship7_total = $row[ship7_total]; $temp_ship8_total = $row[ship8_total]; $temp_ship9_total = $row[ship9_total]; $ship10_total = $row[ship10_total]; echo $temp_ship1_total . "<br>"; $ship_counter = 0; // Initialize loop variable. for ($ship_id = 1; $ship_id <= 10; $ship_id++) { $this_ship_type_counter = 0; $this_ship_atk = "ship" . $ship_id . "_atk"; $this_ship_def = "ship" . $ship_id . "_def"; $this_ship_total = "temp_ship" . $ship_id . "_total"; echo $$this_ship_atk . "<br>"; if ($$this_ship_total > 0) { while ($this_ship_type_counter < $$this_ship_total) { $reinf_force_atk[$x][$ship_counter] = $$this_ship_atk; $reinf_force_def[$x][$ship_counter] = $$this_ship_def; $reinf_force_ship_type[$x][$ship_counter] = $ship_id; $this_ship_type_counter++; $ship_counter++; echo "in the loop<br>"; } } } $num_reinf_fleets++; }