mercredi 27 octobre 2021

Elseif PHP Codeigniter

Im new at codeigniter and i have a problem about if else on my datatable.

Why when i set date 2021-11-01 the result is ACTIVE? I think it should be ALERT.

this is my view

<?php
                $today   = Date("Y-m-d");
                $months  = Date("y-m-d", strtotime('+180 days'));   
    
                
                if ($t->tr_no == NULL) {
                echo 'NEW';
                }
    
                elseif ($t->tr_exp <= $today) {
                echo 'EXPIRED';
                }
    
                elseif ($t->tr_exp > $months) {
                echo 'ALERT';
                }
                
                else {
                echo 'ACTIVE';
                }
    
                ?>

Aucun commentaire:

Enregistrer un commentaire