$b = 0;
$c = 0;
for($a = 1; $a <= 6; $a++) {
echo "<SELECT NAME=\"" . $test_array[$b] . "\">\n";
echo "<OPTION NAME=\"\"></OPTION>\n";
while ($row = mysql_fetch_array(" . $test_result[$c] . ")) {
echo "<OPTION VALUE=\"" . $row['driver_id'] . "\">" . $row['driver_name'] . "</OPTION>\n";
$c++;
}
$b++;
}
The idea of this is to make the script shorter by using loops, but for some reason I can't get this one to work. It dies out on the while loop. MySQL says: Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /PHPTEST3-2.php on line 60
The arrays are:
$test_array = array("Driver_1", "Driver_2", "Driver_3", "Driver_4", "Driver_5", "Driver_6");
$test_result = array("$result_1", '$result_2', '$result_3', '$result_4', '$result_5', '$result_6');
RESULTS ARE:
$result_1 = mysql_query("SELECT FROM d_points ORDER BY driver_id ASC")or die(mysql_error());
$result_2 = mysql_query("SELECT FROM d_points ORDER BY driver_id ASC")or die(mysql_error());
$result_3 = mysql_query("SELECT FROM d_points ORDER BY driver_id ASC")or die(mysql_error());
$result_4 = mysql_query("SELECT FROM d_points ORDER BY driver_id ASC")or die(mysql_error());
$result_5 = mysql_query("SELECT FROM d_points ORDER BY driver_id ASC")or die(mysql_error());
$result_6 = mysql_query("SELECT FROM d_points ORDER BY driver_id ASC")or die(mysql_error());
Also, if anyone can tell me how I would go about reusing one result I would be very greatful. Everytime I try to reuse a result query, the selects that follow end up empty.
TIA!