dimanche 2 février 2020

How to Initilize a variable to use it later in php?

I want to Initialize a variable, and want to use it later in my foreach loop, below is my working:

$lastdepdate = "";

$resultDEP  = "SELECT * FROM mytable";

foreach($resultDEP as $rows){
    $lastdepdate         = trim($row['LastDepDate']);
}

I am getting date from my table and checking it with today's date AND

if ($AssetClassID > 01) {
    $returnDep  = $depSL;
} else if($AssetClassID > 02){
    $returnDep  = $Cost;
}

$DepAmount      = $returnDep;

How can I achieve this in if and else if loop?

Aucun commentaire:

Enregistrer un commentaire