0) { while ($row = @mysqli_fetch_assoc($result)) { $data = $row; } } } } if ($data == null) { $data['status'] = 200; $data['message'] = "Data not found!"; } commit(); echo json_encode($data);