55 lines
1.4 KiB
PHP
55 lines
1.4 KiB
PHP
|
<?php
|
||
|
include('includes/config/config.php');
|
||
|
$section_id = $_POST['section_id'];
|
||
|
$section_name =$_POST['section_name'];
|
||
|
$section_description = $_POST['section_description'];
|
||
|
if(!empty($section_id)){
|
||
|
$query = "update questionnaire_section set section_name = '$section_name', section_description = '$section_description',modified_by = '".$_SESSION['user_id']."' where section_id =
|
||
|
'".$section_id."' ";
|
||
|
}
|
||
|
else {
|
||
|
$query = "insert into questionnaire_section(section_name,section_description,modified_by)
|
||
|
values ('$section_name','$section_description','".$_SESSION['user_id']."' ); ";
|
||
|
}
|
||
|
echo $query;
|
||
|
if (!$result = @mysqli_query($conn,$query)) {
|
||
|
exit(mysqli_error($conn));
|
||
|
}
|
||
|
else{
|
||
|
|
||
|
|
||
|
$query = "select max(section_id) section_id from questionnaire_section ";
|
||
|
if (!$result = @mysqli_query($conn,$query)) {
|
||
|
exit(mysqli_error($conn));
|
||
|
}
|
||
|
if(mysqli_num_rows($result) > 0) {
|
||
|
while ($row = mysqli_fetch_assoc($result)) {
|
||
|
|
||
|
$section_id_max = $row['section_id'];
|
||
|
}
|
||
|
}
|
||
|
|
||
|
|
||
|
$query = "select * from ailment where ailment_id='".$section_id_max."'";
|
||
|
//echo $query;
|
||
|
if (!$result = @mysqli_query($conn,$query)) {
|
||
|
exit(mysqli_error($conn));
|
||
|
}
|
||
|
if(mysqli_num_rows($result) > 0) {
|
||
|
while ($row = mysqli_fetch_assoc($result)) {
|
||
|
|
||
|
$data=$row;
|
||
|
}
|
||
|
}
|
||
|
|
||
|
|
||
|
|
||
|
}
|
||
|
if($data==null)
|
||
|
{
|
||
|
$data['status'] = 200;
|
||
|
$data['message'] = "Data not found!";
|
||
|
}
|
||
|
echo json_encode($data);
|
||
|
?>
|