<?php
if(isset($_GET['sil_id'])){
    $delete = $db->exec("DELETE FROM blog WHERE id = '{$_GET['sil_id']}' LIMIT 1");
    echo b();
}
?>
<div class="page-header">
	<div class="page-leftheader">
		<h4 class="page-title">Blog Yönetimi</h4>
	</div>
	<div class="page-rightheader ml-auto d-lg-flex d-none">
		<ol class="breadcrumb">
			<li class="breadcrumb-item"><a href="index.php">Anasayfa</a></li>
			<li class="breadcrumb-item active" aria-current="page">Blog Yönetimi</li>
		</ol>
	</div>
</div>
						
<div class="row">
	<div class="col-md-12">
		<div class="card">
			<div class="card-body">
				<div class="row">
					<div class="col-md-12">
						
						<div class="table-responsive">
							<table class="table table-bordered text-nowrap" id="example2">
								<thead>
									<tr>
										<th class="wd-15p border-bottom-0">ID</th>
										<th class="wd-15p border-bottom-0">Sayfa Adı</th>
										<th class="wd-15p border-bottom-0">Sayfa Linki</th>
										<th class="wd-15p border-bottom-0">İşlem</th>
									</tr>
								</thead>
								<tbody>
									<?php
				                      $query = $db->query("SELECT * FROM blog ORDER BY id DESC", PDO::FETCH_ASSOC);
				                      if($query->rowCount()){
				                        foreach( $query as $row ){
				                          echo '
				                            <tr>
				                              <td>'.$row['id'].'</td>
				                              <td>'.$row['baslik'].'</td>
				                              <td><a href="'.$site.'blog/'.$row['sef'].'">Sayfaya Gitmek İçin Tıklayın...</a></td>
				                              <td>
				                                <a href="blog-yazisi-ekle/duzenle/'.$row['id'].'" class="badge badge-success" style="margin-right:10px">Düzenle</span>
				                                <a href="'.$sayfa.'/sil/'.$row['id'].'" class="badge badge-danger" style="margin-right:10px">Sil</span>
				                              </td>
				                            </tr>
				                          ';
				                        }
				                      }
				                    ?>
								</tbody>
							</table>
						</div>

					</div>
				</div>
			</div>
		</div>
	</div>
</div>
