<?php
if(isset($_GET['sil_id'])){
    $delete = $db->exec("DELETE FROM kullanici WHERE id = '{$_GET['sil_id']}' LIMIT 1");
    echo b();
}

?>
<div class="page-header">
	<div class="page-leftheader">
		<h4 class="page-title">Müşteriler</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">Müşteriler</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">Adı</th>
										<th class="wd-15p border-bottom-0">Soyadı</th>
										<th class="wd-15p border-bottom-0">Telefon</th>
										<th class="wd-15p border-bottom-0">Email</th>
										<th class="wd-15p border-bottom-0">Adres</th>
										<th class="wd-15p border-bottom-0">İşlem</th>
									</tr>
								</thead>
								<tbody>
									<?php
				                      $query = $db->query("SELECT * FROM kullanici ORDER BY id DESC", PDO::FETCH_ASSOC);
				                      if($query->rowCount()){
				                        foreach( $query as $row ){
				                          echo '
				                            <tr>
				                              <td>'.$row['id'].'</td>
				                              <td>'.$row['ad'].'</td>
				                              <td>'.$row['soyad'].'</td>
				                              <td>'.$row['telefon'].'</td>
				                              <td>'.$row['email'].'</td>
				                              <td>'.$row['adres'].'</td>
				                              <td>
				                                <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>
