im writing a script to insert multiple rows in a database. it inserts the data, but in my table i have 'id' set to auto-increment, and whenever the data is added, it's all messed up...
this displays the forms that need to be filled out:
for ($i = 1; $i <= $_POST[howmany]; $i++) {
$display_block .= " <tr>
<td><strong>$i<input type='hidden' name='songid$i' value='$i'></strong></td>
<td><input type=\"text\" name=\"song$i\" size=\"50\"></td>
<td><input type=\"text\" name=\"file$i\" size=\"35\"></td>
</tr>";
}
and this code inserts the entries into the database
for($i = 1; $i <= $_POST[howmany]; $i++)
{
mysql_query("INSERT INTO evr_tracklist VALUES ('', '$_POST[rls_id]', '$_POST[band_id]', '".$_POST['songid' . $i]."', '" .addslashes($_POST['song' . $i]) . "', '" .addslashes($_POST['file' . $i]) . "')");
}
i inserted data hoping that the auto-increment would add the data like 1,2,3,4,5...
but instead it was added like 4,3,2,1,5
any idea what is going on and how to fix it?