ESH/opd_ticket_updater.php
2024-10-23 18:28:06 +05:30

42 lines
938 B
PHP

<?php
error_reporting(E_ERROR | E_PARSE);
include ('includes/config/config.php');
include ('includes/functions.php');
include('log_entry.php');
begin();
$query = "select * from employee_appointment where `ticket_no` like 'OPD%' ";
error_log("sql " . $query);
if (!$result = @mysqli_query($conn,$query)) {
rollback();
exit(mysqli_error($conn));
}
$data = array();
$i=0;
if(mysqli_num_rows($result) > 0) {
while ($row = mysqli_fetch_assoc($result)) {
$i++;
$sql =" update employee_appointment SET ticket_no=concat('OPD-','".$i."','-2023') where appointment_id='".$row['appointment_id']."' ";
error_log('----'.$sql);
if (!$result_sql = @mysqli_query($conn,$sql)) {
rollback();
exit(mysqli_error($conn));
}
}
$data['status'] = "succes";
$data['message'] = "Assign menu done!";
}
else
{
$data['status'] = 200;
$data['message'] = "Data not found!";
}
commit();
echo json_encode($data);
?>