= '$year-$month-31' ) AND( official_check_date IS NULL OR official_check_date = '' OR official_check_date >= '$year-$month-31' ) "; $sql .= !empty($type) ? " AND contract_type = '$type'" : ""; $sql .= !empty($mtype) ? " AND renovate_type Like '%$mtype%'" : ""; $result = mysqli_query($link, $sql); $data = mysqli_fetch_all($result, MYSQLI_ASSOC); return json_encode($data, JSON_UNESCAPED_UNICODE); } function getInstalling2DetailsSql($type, $mtype, $radsY, $radsM, $year, $month) { global $link; $sql = " SELECT * FROM wipwholestatus WHERE status = '1' AND real_arrival_date BETWEEN '$radsY-$radsM-01' AND '$year-$month-31' AND ( delivery_date IS NULL OR delivery_date = '' OR delivery_date >= '$year-$month-31' ) AND( official_check_date IS NULL OR official_check_date = '' OR official_check_date >= '$year-$month-31' ) "; $sql .= !empty($type) ? " AND contract_type = '$type'" : ""; $sql .= !empty($mtype) ? " AND renovate_type Like '%$mtype%'" : ""; return $sql; }