<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css" integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" crossorigin="anonymous">
<?php
session_start();
include("baglan.php");
$isim = $_POST["isim"];
$sifre = $_POST["sifre"];
$a = $baglan -> prepare("select * from tablo where isim=? and sifre=?");
$a -> execute(array($isim,$sifre));
$b = $a -> fetch();
if ($b){
$_SESSION["isim"] = $isim;
$_SESSION["sifre"]= $sifre;
$_SESSION["rutbe"]= $b["rutbe"];
if ($_SESSION["rutbe"]==1){
echo "Merhaba Hoşgeldiniz "."<b>".$_SESSION["isim"]."</b> olarak giriş yaptınız"."<br>";
echo "<a href='cikis.php'>Oturumu Kapat</a>";
echo '<table class="table table-info">
<thead>
<tr>
<td class="bg-info">ID</th>
<td class="bg-warning">İsim</th>
<th class="bg-success" scope="col">Başlık</th>
<th class="bg-danger" scope="col">Yazı</th>
<th class="bg-primary" scope="col">Rütbe</th>
<th class="table-dark" scope="col">Tarih</th>
</tr>
</thead>
<tbody>
<?php
$islem = $baglan -> prepare("select * from tablo ");
$islem -> execute(array());
$islem2 = $islem -> fetchall();
foreach ($islem2 as $islem3){ ?>
<tr>
<th scope="row"><?php echo $islem3["id"]; ?></th>
<td><?php echo $islem3["isim"]; ?></td>
<td><?php echo $islem3["baslik"]; ?></td>
<td><?php echo $islem3["yazi" ]; ?></td>
<td><?php echo $islem3["rutbe"]; ?></td>
<td><?php echo $islem3["tarih"]; ?></td>
</tr>
<?php
}
?>
</tbody>
</table>
';
}
if ($_SESSION["rutbe"]==2) {
echo "Merhaba Hoşgeldiniz ". "<b>". $_SESSION["isim"]."</b> olarak giriş yaptınız"."<br>";
echo "<a href='cikis.php'>Oturumu Kapat</a>";
}
if ($_SESSION["rutbe"]==0){
echo "banlısınız yasaklasınız";
header("refresh:1;url=index.php");
}}
else {
header("location:index.php");
}
?> echo içinde foreach kısmının çalışmaması
17
●510
- 13-06-2019, 16:47:39echo içine aldığım foreach kısmı çalışmıyor foreachi nasıl dahil edebilirim teşekkürler
- 13-06-2019, 17:13:15Php tagı açıp kapatmaktansa echo içerisinde kullanın html kodlarınızı
- 13-06-2019, 17:25:00teşekkürler mesajınız için hocam sonuç yine aynı böle bir çıktı var şuanM3M4Ti adlı üyeden alıntı: mesajı görüntüle

hocam bir örnek verir misiniz teşekkürlermetehandemir adlı üyeden alıntı: mesajı görüntüle
siz de bir örnek verirsiniz sevinirim hocam anlayamadım yazdığınızıDreaMYs adlı üyeden alıntı: mesajı görüntüle
arkadaşlar sorunu kendi çapımda şöle çözdüm echo ile yazdırmak istediğim kısmı başka bir sayfaya kaydettim echo yazılacak kısma da malumunuz include dahil ettim takır takır çalışıyor
- 13-06-2019, 23:22:40Çözmen güzel ama ikisini aynı sayfada yapmayı öğren derim yine kolay gelsin iyi çalışmalar.Fys adlı üyeden alıntı: mesajı görüntüle
- 14-06-2019, 00:10:00hocam gözümaydın tek sayfa da yapmayı da başardımM3M4Ti adlı üyeden alıntı: mesajı görüntüle

<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css" integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" crossorigin="anonymous"> <?php session_start(); include("baglan.php"); $isim = $_POST["isim"]; $sifre = $_POST["sifre"]; $a = $baglan -> prepare("select * from tablo where isim=? and sifre=?"); $a -> execute(array($isim,$sifre)); $b = $a -> fetch(); if ($b){ $_SESSION["isim"] = $isim; $_SESSION["sifre"]= $sifre; $_SESSION["rutbe"]= $b["rutbe"]; if ($_SESSION["rutbe"]==1){ echo "Merhaba Hoşgeldiniz "."<b>".$_SESSION["isim"]."</b> olarak giriş yaptınız"."<br>"; echo "<a href='cikis.php'>Oturumu Kapat</a>"; echo '<table class="table table-info"> <thead> <tr> <td class="bg-info">ID</th> <td class="bg-warning">İsim</th> <th class="bg-success" scope="col">Başlık</th> <th class="bg-danger" scope="col">Yazı</th> <th class="bg-primary" scope="col">Rütbe</th> <th class="table-dark" scope="col">Tarih</th> </tr> </thead>'; $islem = $baglan -> prepare("select * from tablo "); $islem -> execute(array()); $islem2 = $islem -> fetchall(); foreach ($islem2 as $key => $islem3) { ?> <tr> <th><?php echo $islem3["id"]; ?></th> <td><?php echo $islem3["isim"]; ?></td> <td><?php echo $islem3["baslik"]; ?></td> <td><?php echo $islem3["yazi" ]; ?></td> <td><?php echo $islem3["rutbe"]; ?></td> <td><?php echo $islem3["tarih"]; ?></td> </tr> <?php } ?> <?php } if ($_SESSION["rutbe"]==2) { echo "Merhaba Hoşgeldiniz ". "<b>". $_SESSION["isim"]."</b> olarak giriş yaptınız"."<br>"; echo "<a href='cikis.php'>Oturumu Kapat</a>"; } if ($_SESSION["rutbe"]==0){ echo "banlısınız yasaklasınız"; header("refresh:1;url=index.php"); }} else { header("location:index.php"); } ?>
