samedi 21 mars 2020

If else loop in a php loop (row)

is it possible to do a if/else in a row loop in PHP? My try is not working... Maybe you can help me please? Hope you guys are at home and save :)

<?php 

$uid = $user['id'];

$statement = $pdo->prepare("SELECT * FROM audit WHERE cid = $cid AND uid = $uid ORDER BY id");
$result = $statement->execute();
$count = 1;
while($row = $statement->fetch()) {
echo "<tr>";

echo "<td>".$row['request_date']."</td>";
echo "<td>".$row['supplier_name']."</td>";
echo "<td>".$row['audit_req_decision']."</td>";
echo "<td>".$row['audit_reason']."</td>";

$general_audit_status = $row['general_audit_status'];

if $general_audit_status == "Abgeschlossen" {
echo "<td>".$row['audit_result_rating']. " / " .$row['audit_result']." %</td>";
} else {
echo "<td>" "Resultat offen"" %</td>";
}

echo "<td>".$row['general_audit_status']."</td>";
echo '<td><a href="audit_req_auditor_decision.php?id='.$row['id'].'"><i class="fas fa-edit"></i></a></td>';

echo "</tr>";
}
?>

Aucun commentaire:

Enregistrer un commentaire