I have the following code which should be inserting into the database x amount of times depending on the value given $row['max'] however only 1 is being inserted. Can someone please show me the error of my ways! Thanks.
$query = "SELECT * FROM challenges WHERE rate='fixed'";
$query_result = mysql_query($query);
while ($row = mysql_fetch_array($query_result)) {
$spawn_time = preg_split('/,/', $row['time']);
$spawn_time_results = count($spawn_time);
$limitno = $row['max'];
$spawn_counter = 0;
while ($spawn_counter <= $spawn_time_results) {
if ($spawn_time[$spawn_counter] == date("i")) {
$time = time();
$insert_instance = "INSERT INTO instances (id,defeated,time)
VALUES ('{$row['id']}',0,{$time})";
$insert_result = mysql_query($insert_instance);
}
$spawn_counter++;
}
}
$insert_result=mysql_query($insert_instance);with$insert_result=mysql_query($insert_instance) or die(mysql_error());