hey guys im trying to update my database here, the code is running fine
session_start();
$school_id = $_SESSION['school_id'];
$faculty_id = $_SESSION['user_id_fac'];
$subject_id = $_POST['subject_id'];
$year_grade_level = $_POST['year_level'];
$subject_handeler_id = $_POST['subject_handler_id'];
$student_grades_boy = $_POST['student_grades_boy'];
$student_grades_girl = $_POST['student_grades_girl'];
$values_boy = array();
foreach ($student_grades_boy as $key=>$data) {
$student_id_B= $data['studnt_B_id'];
$grade_B = $data['studnt_grade_B'];
$values_boy[$key] = "UPDATE registrar_grade_archive SET grade = ".$grade_B." WHERE student_id = ".$student_id_B." AND subject_id = ".$subject_id." AND school_id = ".$school_id." AND advisor_faculty_id = ".$faculty_id." AND subject_handler_id = ".$subject_handeler_id." ";
$save_grades_boy = mysql_query($values_boy[$key]) or die(mysql_error());
}
but it keeps bugging me, cuz every loop the php will make a request query wich may slowdown my site. Is there a way to improve the codes on multiple updating my table in database?