ohctech_p8/select_salt.php
Dushant Mali 899fb3e65a Upgrade 7 to 8
Upgrade 7 to 8
2024-11-02 18:03:13 +05:30

48 lines
1.2 KiB
PHP

<?php
include('includes/config/config.php');
include('log_entry.php');
$id = $_POST['id'];
$name=$_POST['name'];
$data = array();
if(!empty($id)){
$query = "select * from salt_master where salt_id = '$id' ";
if (!$result = @mysqli_query($conn,$query)) {
die(mysqli_error($conn));
}
if(mysqli_num_rows($result) > 0) {
while ($row = mysqli_fetch_assoc($result)) {
$data= $row;
}
}
else
{
$data['status'] = 200;
$data['message'] = "Data not found!";
}
}else{
$query = "select * from salt_master where upper(salt_name)= upper('$name') ";
error_log($query);
if (!$result = @mysqli_query($conn,$query)) {
die(mysqli_error($conn));
}
if(mysqli_num_rows($result) > 0) {
while ($row = mysqli_fetch_assoc($result)) {
array_push($data, $row);
}
}
else
{
$data['status'] = 200;
$data['message'] = "Data not found!";
}
$data['count'] = mysqli_num_rows($result);
}
error_log(print_r($data,true));
echo json_encode($data);
?>