65 lines
2.5 KiB
PHP
65 lines
2.5 KiB
PHP
<?php
|
|
include('includes/config/config.php');
|
|
include('log_entry.php');
|
|
|
|
$ohc_type_id = $_SESSION['current_ohcttype'];
|
|
$count = $_POST['count'];
|
|
$response = [];
|
|
$errorOccurred = false;
|
|
|
|
for ($i = 0; $i < $count; $i++) { // Changed loop condition to $i < $count
|
|
$id = $_POST['interm_enquiry_id' . $i];
|
|
$beneficiary_name = mysqli_real_escape_string($conn, $_POST['beneficiary_name' . $i]);
|
|
$enquiry_date = mysqli_real_escape_string($conn, $_POST['enquiry_date' . $i]);
|
|
$course_id = mysqli_real_escape_string($conn, $_POST['course' . $i]);
|
|
$gender = mysqli_real_escape_string($conn, $_POST['gender' . $i]);
|
|
$village = mysqli_real_escape_string($conn, $_POST['village' . $i]);
|
|
$dob = mysqli_real_escape_string($conn, $_POST['dob' . $i]);
|
|
$trainees_no = mysqli_real_escape_string($conn, $_POST['trainees_no' . $i]);
|
|
$aadhar_phone = mysqli_real_escape_string($conn, $_POST['aadhar_phone' . $i]);
|
|
$parents_no = mysqli_real_escape_string($conn, $_POST['parents_no' . $i]);
|
|
$education = mysqli_real_escape_string($conn, $_POST['education' . $i]);
|
|
$reference_from = mysqli_real_escape_string($conn, $_POST['reference_from' . $i]);
|
|
// $admission_status = mysqli_real_escape_string($conn, $_POST['admission_status' . $i]);
|
|
$type = mysqli_real_escape_string($conn, $_POST['type' . $i]);
|
|
|
|
// Prepare SQL query
|
|
$sql = "UPDATE interm_enquiry
|
|
SET beneficiary_name = '$beneficiary_name',
|
|
enquiry_date = '$enquiry_date',
|
|
course_id = '$course_id',
|
|
gender = '$gender',
|
|
village = '$village',
|
|
dob = '$dob',
|
|
trainees_no = '$trainees_no',
|
|
aadhar_phone = '$aadhar_phone',
|
|
perents_no = '$parents_no',
|
|
education = '$education',
|
|
reference_from = '$reference_from',
|
|
addmission_status = 'BPE',
|
|
type = '$type'
|
|
WHERE interm_enquiry_id = '$id'";
|
|
|
|
error_log("Check_update_query: " . $sql);
|
|
|
|
// Execute the query
|
|
if ($conn->query($sql) === TRUE) {
|
|
error_log("Record updated successfully for ID: $id");
|
|
} else {
|
|
error_log("Error updating record for ID $id: " . $conn->error);
|
|
$errorOccurred = true; // Set error flag
|
|
$response['errors'][] = "Error updating ID $id: " . $conn->error; // Capture errors
|
|
}
|
|
}
|
|
|
|
// Prepare response
|
|
if ($errorOccurred) {
|
|
$response['success'] = false;
|
|
} else {
|
|
$response['success'] = true;
|
|
}
|
|
|
|
// Send JSON response
|
|
echo json_encode($response);
|
|
?>
|