I applied two condition in which if leave is half day or full day then subtract it from Remleaves or else if leave is Sick or Casual then subtract it from Scremleaves. Pls Help in PHP Coding Help Posted October 26, 2021 <td style="font-size:16px;"><b>No of Leaves Available: </b></td> <td colspan="3"> <?php $st1 = "<?php echo htmlentities($result->LeaveType);?>"; $st2 = "Half Day"; $st3 = "Full Day"; if($st1 == $st2 or $st3){ $stats=$result->Status; if($stats==1 && $update==1){$ld=($result->Remleaves)-($result->Applydays);} else{$ld=$result->Remleaves;} if($ld<=0){ $ld=0; //$war="(Available Leaves got exhausted)"; } echo htmlentities($ld); ?> <span style="color:red"><?php echo htmlentities($war);?></span><?php $eid=$result->id; $sql='update tblemployees set Remleaves=:ld where id=:eid'; $query = $dbh->prepare($sql); $query->bindParam(':ld',$ld,PDO::PARAM_STR); $query->bindParam(':eid',$eid,PDO::PARAM_INT); $query->execute(); $lastInsertId = $dbh->lastInsertId(); } else{ $st1 = "<?php echo htmlentities($result->LeaveType);?>"; $st2 = "Sick Leave"; $st3 = "Casual Leave"; if($st1 == $st2 or $st3){ $stats=$result->Status; if($stats==1 && $update==1){$ld=($result->Scremleaves)-($result->Applydays);} else{$ld=$result->Scremleaves;} if($ld<=0){ $ld=0; //$war="(Available Leaves got exhausted)"; } echo htmlentities($ld); ?> <span style="color:red"><?php echo htmlentities($war);?></span><?php $eid=$result->id; $sql='update tblemployees set Scremleaves=:ld where id=:eid'; $query = $dbh->prepare($sql); $query->bindParam(':ld',$ld,PDO::PARAM_STR); $query->bindParam(':eid',$eid,PDO::PARAM_INT); $query->execute(); $lastInsertId = $dbh->lastInsertId(); } }?></td>
I applied two condition in which if leave is half day or full day then subtract it from Remleaves or else if leave is Sick or Casual then subtract it from Scremleaves. Pls Help
in PHP Coding Help
Posted
<td style="font-size:16px;"><b>No of Leaves Available: </b></td>
<td colspan="3">
<?php
$st1 = "<?php echo htmlentities($result->LeaveType);?>";
$st2 = "Half Day";
$st3 = "Full Day";
if($st1 == $st2 or $st3){
$stats=$result->Status;
if($stats==1 && $update==1){$ld=($result->Remleaves)-($result->Applydays);}
else{$ld=$result->Remleaves;}
if($ld<=0){
$ld=0;
//$war="(Available Leaves got exhausted)";
}
echo htmlentities($ld);
?> <span style="color:red"><?php echo htmlentities($war);?></span><?php
$eid=$result->id;
$sql='update tblemployees set Remleaves=:ld where id=:eid';
$query = $dbh->prepare($sql);
$query->bindParam(':ld',$ld,PDO::PARAM_STR);
$query->bindParam(':eid',$eid,PDO::PARAM_INT);
$query->execute();
$lastInsertId = $dbh->lastInsertId();
}
else{
$st1 = "<?php echo htmlentities($result->LeaveType);?>";
$st2 = "Sick Leave";
$st3 = "Casual Leave";
if($st1 == $st2 or $st3){
$stats=$result->Status;
if($stats==1 && $update==1){$ld=($result->Scremleaves)-($result->Applydays);}
else{$ld=$result->Scremleaves;}
if($ld<=0){
$ld=0;
//$war="(Available Leaves got exhausted)";
}
echo htmlentities($ld);
?> <span style="color:red"><?php echo htmlentities($war);?></span><?php
$eid=$result->id;
$sql='update tblemployees set Scremleaves=:ld where id=:eid';
$query = $dbh->prepare($sql);
$query->bindParam(':ld',$ld,PDO::PARAM_STR);
$query->bindParam(':eid',$eid,PDO::PARAM_INT);
$query->execute();
$lastInsertId = $dbh->lastInsertId();
}
}?></td>