Search the Community
Showing results for tags 'php quary mysql'.
-
This is a snippet from a site i built the code is suppose to take information from a database and display it then if the user changes it via a drop down menu and an update button it will change the information and again display it. The first display labeled infants works correctly but then nothing else does. It all updates the DB like it is suppose to but just wont display it. I have been banging my head for days on this any help would be great. FYI This all worked properly for about 8 months then just one day stopped. mysql_query("update schedule set ".$field_name." = '".$_POST['infant_ch']."' where schedule_track_id = '".$track_id."' and employee = 'Enrollment' and class='infants' "); mysql_query("update schedule set ".$field_name." = '".$_POST['wobbler_ch']."' where schedule_track_id = '".$track_id."' and employee = 'Enrollment' and class='wobler' "); mysql_query("update schedule set ".$field_name." = '".$_POST['orange_ch']."' where schedule_track_id = '".$track_id."' and employee = 'Enrollment' and class='orange' "); mysql_query("update schedule set ".$field_name." = '".$_POST['green_ch']."' where schedule_track_id = '".$track_id."' and employee = 'Enrollment' and class='green' "); mysql_query("update schedule set ".$field_name." = '".$_POST['red_ch']."' where schedule_track_id = '".$track_id."' and employee = 'Enrollment' and class='red' "); mysql_query("update schedule set ".$field_name." = '".$_POST['blue_ch']."' where schedule_track_id = '".$track_id."' and employee = 'Enrollment' and class='blue' "); mysql_query("update schedule set ".$field_name." = '".$_POST['purple_ch']."' where schedule_track_id = '".$track_id."' and employee = 'Enrollment' and class='purple' "); mysql_query("update schedule set ".$field_name." = '".$_POST['yellow_ch']."' where schedule_track_id = '".$track_id."' and employee = 'Enrollment' and class='yellow' "); mysql_query("update schedule set ".$field_name." = '".$_POST['silver_ch']."' where schedule_track_id = '".$track_id."' and employee = 'Enrollment' and class='silver' "); mysql_query("update schedule set ".$field_name." = '".$_POST['school_ch']."' where schedule_track_id = '".$track_id."' and employee = 'Enrollment' and class='clubhouse' "); $enroll_query = mysql_query("select * from schedule Where employee = 'Enrollment' and CURDATE() between start_date and end_date and schedule_track_id = '".$track_id."' "); while($data = mysql_fetch_assoc($enroll_query)) { $enroll_data[] = $data; } $new_field_name = $field_name.'_s'; // This is the display section// <td align="center" valign="top"><table width="90" border="1" cellpadding="0"> <tr> <td height="200" align="center" valign="middle"><label for="infant_ch"></label> <select name="infant_ch" id="infant_ch"> <?php if($enroll_data[0]['class'] == 'infants') { $data_field = $enroll_data[0][$field_name]; for($i=0;$i<=30;$i++) { ?> <option value="<?php echo $i; ?>" <?php if ($i==$data_field) { echo "selected";}?>><?php echo $i; ?></option> <?php } } else { for($i=0;$i<=30;$i++) { ?> <option value="<?php echo $i; ?>" ><?php echo $i; ?></option> <?php } } ?> </select></td> </tr> <tr> <td height="200" align="center"><label for="wobbler_ch"></label> <select name="wobbler_ch" id="wobbler_ch"> <?php if($enroll_data[1]['class'] == 'wobler') { $data_field = $enroll_data[1][$field_name]; for($i=0;$i<=30;$i++) { ?> <option value="<?php echo $i; ?>" <?php if ($i==$data_field) { echo "selected";}?>><?php echo $i; ?></option> <?php } } else { for($i=0;$i<=30;$i++) { ?> <option value="<?php echo $i; ?>" ><?php echo $i; ?></option> <?php } } ?> </select></td> </tr> <tr> <td height="200" align="center"><label for="orange_ch"></label> <select name="orange_ch" id="orange_ch"> <?php if($enroll_data[2]['class'] == 'orange') { $data_field = $enroll_data[2][$field_name]; for($i=0;$i<=30;$i++) { ?> <option value="<?php echo $i; ?>" <?php if ($i==$data_field) { echo "selected";}?>><?php echo $i; ?></option> <?php } } else { for($i=0;$i<=30;$i++) { ?> <option value="<?php echo $i; ?>" ><?php echo $i; ?></option> <?php } } ?> </select></td> </tr> <tr>