<?php

session_start();
include_once "../class/CheckAsset.php";
$updateChk = new CheckAsset();
$checkId = $_GET["checkId"];
$status = $_GET["status"];
$userId = $_SESSION["id"];
if ($status == "ใช้งานได้") {
    $stat = "Y";
} else {
    if ($status == "ชำรุด") {
        $stat = "N";
    } else {
        if ($status == "เสื่อมสภาพ") {
            $stat = "D";
        } else {
            $stat = null;
        }
    }
}
$updateChk->setCheckId($checkId);
$updateChk->setCheckStatus($stat);
$updateChk->setUserId($userId);
$updateChk->checkAssetStatus();
<?php

include_once "../class/Config.php";
include_once "../class/CheckAsset.php";
$checkAsset = new CheckAsset();
$dbAsset = new config();
$checkId = $_GET["checkId"];
//$checkId = "6";
$checkAsset->setCheckId($checkId);
$arr = $checkAsset->getCheckAssetById();
$data_array = array();
$no = 0;
while ($res = $dbAsset->fetch_object($arr)) {
    if ($res->checkStatus == "Y") {
        $stat = "ใช้งานได้";
    } else {
        if ($res->checkStatus == "N") {
            $stat = "ชำรุด";
        } else {
            if ($res->checkStatus == "D") {
                $stat = "เสื่อมสภาพ";
            } else {
                if ($res->checkStatus == null) {
                    $stat = "-";
                }
            }
        }
    }
    $selDate = $res->assetAddDate;
    $newYear = $res->assetYear;
    $dateM = substr($selDate, 4, 6);