Hey, this is an English text. I want you to translate it into the Tunisian dialect. Please follow these steps:
1. Translate step by step and highlight differences between Tunisian dialect and Modern Standard Arabic.
2. Highlight sections you are confident translating into the Tunisian dialect.
Translate this text into the Tunisian dialect, focusing on capturing the essence of the language nuances:

Q: Updating checkbox into mysql database How do i update checkbox value into database $fmcourse = $_POST['fm_courses']; foreach($fmcourse as $fmc) { $studentid = mysqli_real_escape_string($con, $_POST["id"]); $sql = "UPDATE enrollments SET course_fk='$fmc' WHERE student_fk = '$studentid'"; } var_dump(fmc) output this string(2) "18" string(2) "20" string(2) "22" string(2) "24" string(2) "26" When i update the course_fk repeats the same id on all the rows +-----+------------+-----------+ | eid | student_fk | course_fk | +-----+------------+-----------+ | 1 | 1 | 17 | | 2 | 1 | 17 | | 3 | 1 | 17 | +-----+------------+-----------+ I am looking for this +-----+------------+-----------+ | eid | student_fk | course_fk | +-----+------------+-----------+ | 1 | 1 | 17 | | 2 | 1 | 20 | | 3 | 1 | 22 | +-----+------------+-----------+ A: The code below checks, using the function record_exists(), if the record has duplicates in enrollments table, if it has, then the code just updates the duplicates accordingly. If no duplicates, then it creates a new enrollment record for a student. Updated Code. $fmcourse = $_POST['fm_courses']; $student_id = $_POST["id"]; $batch_id = $_POST["name"]; delete_enrollments( $student_id, $batch_id ); foreach($fmcourse as $fmc) { $course_id = $fmc; if( record_exists( $student_id, $course_id, $batch_id ) == FALSE ) { $stmt = mysqli_prepare($conn, "INSERT INTO enrollments (enrollment_id, student_id, course_id, batch_id, is_deleted, joining_date) VALUES( NULL, ?, ?, ?, 0, NOW() );"); $is_binded = mysqli_stmt_bind_param($stmt, "iii", $student_id, $course_id, $batch_id); $is_exec = mysqli_stmt_execute($stmt); mysqli_stmt_close($stmt); } else { undelete_enrollment($student_id, $course_id, $batch_id); } } function undelete_enrollment($student_id, $course_id, $batch_id) { global $conn; $stmt = mysqli_prepare($conn, "UPDATE enrollments SET is_deleted = 0, joining_date = NOW() WHERE student_id= ? AND course_id = ? AND batch_id = ?"); $is_binded = mysqli_stmt_bind_param($stmt, "iii", $student_id, $course_id,$batch_id); $is_exec = mysqli_stmt_execute($stmt); mysqli_stmt_close($stmt); return $is_exec; } function record_exists( $student_id, $course_id, $batch_id ) { global $conn; $stmt = mysqli_prepare($conn, "SELECT COUNT(enrollment_id) as total FROM enrollments WHERE student_id= ? AND course_id = ? AND batch_id = ?"); $is_binded = mysqli_stmt_bind_param($stmt, "iii", $student_id, $course_id, $batch_id); $is_exec = mysqli_stmt_execute($stmt); $result = mysqli_stmt_get_result($stmt); $record = mysqli_fetch_assoc($result); mysqli_stmt_close($stmt); return ( isset( $record['total'] ) AND $record['total'] > 0 ); } function delete_enrollments( $student_id, $batch_id ) { global $conn; $stmt = mysqli_prepare($conn, "UPDATE enrollments SET is_deleted = 1 WHERE student_id = ? AND batch_id =?;"); $is_binded = mysqli_stmt_bind_param($stmt, "ii", $student_id, $batch_id); $is_exec = mysqli_stmt_execute($stmt); mysqli_stmt_close($stmt); return $is_exec; }