I'm working on a project and I'm stuck on a moment and I can maybe use some help from you guys.
I'm running a while loop and in the while loop I'm using a button. I want to update that specific row
of the button.
But at my code now, it updates a row randomly.
This is my code:
<form name="faturalar" method="POST">
<h4> Ödenmemiş Faturalarım </h4>
</br>
<table class="table table-striped table-dark">
<thead>
<tr style="color:white">
<th> # </th>
<th> Ceza </th>
<th> Miktar </th>
<th> Ödeme </th>
</tr>
</thead>
<tbody>
<?php
$count=1;
$sel_query="SELECT * from billing WHERE identifier= '{$cid}';";
$result = mysqli_query($svcon,$sel_query);
while($row = mysqli_fetch_assoc($result)) {
$fatMiktar = $row["amount"];
if ($_SERVER['REQUEST_METHOD'] === 'POST') {
if (isset($_POST['odeme'])) {
$yeniMiktar = $BankaAl - $fatMiktar;
$yeniAccount = array("bank"=>$yeniMiktar, "money"=>$NakitAl, "black_money"=>$BlackAl);
$bankEncode = json_encode($yeniAccount);
$up = "UPDATE users set accounts = '$bankEncode' WHERE id = '{$cid}'";
$upresult = $svcon->query($up);
$uprow = mysqli_fetch_array($upresult);
header("Refresh:0");
}
}
?>
<tr><td><?php echo $count; ?></td><td><?php echo $row["label"]; ?></td><td><?php echo $row["amount"]; ?></td><td><input name="odeme" type="submit" value="Öde" class="btn btn-primary"></td></tr>
<?php $count++; } ?>
</tbody>
</table>
</form>
I searched on stackoverflow but I didn't find any topic that I could use. What am I doing wrong?