echo içine aldığım foreach kısmı çalışmıyor foreachi nasıl dahil edebilirim teşekkürler

<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");
    
}
?>