booking/work/order/ajax/get_branch_ajax.php
2025-03-24 19:02:58 +03:00

28 lines
982 B
PHP

<?php
require_once('../../../fixed/config/go_con.php');
$emp_Name_id = mysqli_real_escape_string($db, $_POST['empName']);
$value = '';
if (!empty($emp_Name_id)) {
$get_services_sql = mysqli_query($db, "SELECT `branch`.`id`, `branch`.`branch_name` FROM `emplyee` LEFT JOIN `branch` ON `branch`.`id` = `emplyee`.`branch_id`
WHERE `emplyee`.`id` = $emp_Name_id");
if (mysqli_num_rows($get_services_sql) > 0) {
while ($services_row = mysqli_fetch_assoc($get_services_sql)) {
$value = $services_row['branch_name'];
$value_id = $services_row['id'];
}
}
}
// Set the return value in json format
$returnValue = json_encode(array('val' => $value, 'id' => $value_id));
// Setting the header information to json format
header('Content-Type: application/json');
// Display the information and return the control to the calling page
echo $returnValue;
?>