I have a schedule tool that allows people to keep track of events. I need to implement a feature that allows them to move an event to another location in the sequence. I have an id field in a table that I want the user to be able to change to effect this order. The events are edited all at once, with a sequence of forms created on a page via a loop, and each form element to be recorded named and stored with an array (example: event[]). The trouble is happening on the page that recieves the changed form info and then tries to loop through the info to UPDATE the correct info. Here is my code as it stands:
#loop to update shedule database
#config.inc should have already connected to database
for($count=0;$count<=count($id);$count++)
{
$sql = "UPDATE schedule SET id='$id[$count]', class_type='$class_type[$count]', class_date='$class_date[$count]', week='$week[$count]', event='$event[$count]', date_posted='$date_posted' WHERE id='$old_id[$count]'";
$result = mysql_query($sql) or die("There was a problem making the changes you requested.$admin_footer");
}
What I am getting is the die message. I can not see where the problem is. Things worked great when I was not trying to change the order of things. Is this a bad approach to this problem (changing the id)?
Help!