function val_md_day($col,$val,$row, $instanceName) { // Delete image file if it already existed $query = "select md_day from ess where md_day = :md_day"; $queryParams = array('md_day' => $val); $stmt = $this->Editor->doQuery($query,$queryParams); if($row = $stmt->fetch(PDO::FETCH_ASSOC)) { $not_found = 1; $n = 1; $check_date = $val; while($not_found) { $check_date = date('Y-m-d', strtotime('-1 day', strtotime($check_date))); $query1 = "SELECT md_day FROM ess WHERE md_day = :md_day "; $queryParams1 = array('md_day' => $check_date); $stmt1 = $this->Editor->doQuery($query1,$queryParams1); if($row1 = $stmt1->fetch(PDO::FETCH_ASSOC)) { $not_found = 1; } else { $not_found = 0; $this->Editor->showDefaultValidationMsg = false; $this->Editor->addTooltipMsg('Available Date is : ' . $check_date ); return false; } } } else { return true; } }