<?php
$query = $db->prepare("SELECT * FROM siparis_detay INNER JOIN urun ON siparis_detay.urun_id = urun.urun_id WHERE siparis_detay.siparis_id = ?");
$query->execute(array($_GET['siparis_id']));
$listele = $query->fetchAll(PDO::FETCH_ASSOC);
?>
<?php foreach($listele as $urunler):?>
<tr>
<td><form><input type="checkbox"></form></td>
<td><img src="imagesdemo-img.jpg" width="100" alt=""></td>
<td><?php echo $urunler['urun_ad'] ?></td>
<td><?php echo $urunler['urun_id'] ?></td>
<td><form><input type="text" class="form-control quantity" value="<?php echo $urunler['urun_adet'] ?>"></form></td>
<td><?php echo $urunler['urun_fiyat'] ?></td>
</tr>
<?php endforeach;?> PHP Sepet Toplamı Yazdırma
3
●251
- 22-11-2019, 12:55:31Arkadaşlar merhaba sepetteki ürünlerin toplam fiyatını nasıl yazdırabilirim? Şimdiden teşekkürler.
- 22-11-2019, 12:57:35
<?php $query = $db->prepare("SELECT * FROM siparis_detay INNER JOIN urun ON siparis_detay.urun_id = urun.urun_id WHERE siparis_detay.siparis_id = ?"); $query->execute(array($_GET['siparis_id'])); $listele = $query->fetchAll(PDO::FETCH_ASSOC); ?> <?php $toplam=0; foreach($listele as $urunler): $toplam += $urunler['urun_fiyat']; ?> <tr> <td><form><input type="checkbox"></form></td> <td><img src="imagesdemo-img.jpg" width="100" alt=""></td> <td><?php echo $urunler['urun_ad'] ?></td> <td><?php echo $urunler['urun_id'] ?></td> <td><form><input type="text" class="form-control quantity" value="<?php echo $urunler['urun_adet'] ?>"></form></td> <td><?php echo $urunler['urun_fiyat'] ?></td> </tr> <?php endforeach;?> <?php echo 'Toplam:' . $toplamŞeklinde yazdırabilirsiniz