herkese selam arkadaşlar
arkadaşlar baya aradım ama bulamadım sorun nedir acaba neyden kaynaklanıyor
şimdiden zaman ayırıp yardım eden herkese teşekkürler
<?php include("fonksiyon.php"); $clas= new uye; ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link rel="stylesheet" href="dosya/boost.css" >
<title>PDO ÜYELİK SİSTEMİ</title>
</head>
<body>
<div class="container-fluid">
<div class="row">
<div class="col-md-6 mx-auto mt-4" >
<?php
@$hareket=$_GET["hareket"];
switch($hareket):
case"ekle":
$clas->ekle($baglanti);
break;
case"uyeguncelle":
$clas->guncelle($baglanti);
break;
case"uyesil":
$clas->sil($baglanti);
break;
default;
?>
<table class="table table-bordered table-striped text-center bg-white">
<thead>
<tr>
<th colspan="6"> <a href="index.php?hareket=ekle" > Ekle </a></th>
</tr>
</thead>
<thead>
<tr>
<th class="font-weight-bold">AD</th>
<th class="font-weight-bold">SOYAD</th>
<th class="font-weight-bold">YAŞ</th>
<th class="font-weight-bold">AİDAT</th>
<th class="font-weight-bold">GÜNCELLE</th>
<th class="font-weight-bold">SİL</th>
</tr>
</thead>
<tbody>
<?php
echo $clas->listele($baglanti);
?>
</tbody>
</table>
<?php
break;
endswitch;
?>
</div>
</div>
</div>
</body>
</html>
<?php
try {
$baglanti = new PDO("mysql:host=localhost;dbname=kisiler;charset=utf8", "root","123456");
$baglanti->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
} catch (PDOException $e) {
die($e->getMessege());
}
class uye {
function guncelle ($baglanti){
@$uyeid=$_GET["id"];
@$buton=$_POST["buton"];
if($buton):
@$id=($_POST["id"]);
$ad=($_POST["ad"]);
$soyad=($_POST["soyad"]);
$yas=($_POST["yas"]);
$aidat=($_POST["aidat"]);
if(empty($ad) or empty($soyad) or empty($yas) or empty($aidat) ):
echo"boş olamaz ";
else:
$guncelle=$baglanti->prepare("update uyeler set ad=?, soyad=?, yas=?, aidat=? where id=$id)");
$guncelle->bindParam(1,$ad,PDO::PARAM_STR);
$guncelle->bindParam(2,$soyad,PDO::PARAM_STR);
$guncelle->bindParam(3,$yas,PDO::PARAM_STR);
$guncelle->bindParam(4,$aidat,PDO::PARAM_INT);
$guncelle->execute();
echo"Güncelleme Başarılı";
endif;
else:
echo '<table class="table table-border table-striped text-center bg-white">
<thead>
<tr>
<th colspan="6">Üye Ekleme</th>
</tr>
</thead>
<tbody>
<tr>
<td colspan="6">
<form action="index.php?hareket=uyeguncelle" method="post">';
$guncellem=$baglanti->prepare("select * from uyeler where id=$uyeid");
$guncellem->execute();
$songun=$guncellem->fetch();
echo '<input type="text" name="ad" class="form-control mx-auto col-md-3 mt-2" value="'.$songun["ad"].'" />
<input type="text" name="soyad" class="form-control mx-auto col-md-3 mt-2" value="'.$songun["soyad"].'" />
<input type="text" name="yas" class="form-control mx-auto col-md-3 mt-2" value="'.$songun["yas"].'" />
<input type="text" name="aidat" class="form-control mx-auto col-md-3 mt-2" value="'.$songun["aidat"].'" />
<input type="submit" name="buton" class="btn btn-success" value="EKLE" />
</form>
</td>
<tr>
</tbody>
</table>';
endif;
}
function sil($baglanti){
$uyesil=$_GET["id"];
if(empty($uyesil)):
echo"hata var";
else:
$sil=$baglanti->prepare("delete from uyeler where id=$uyesil ") ;
$sil->execute();
echo "silme başarılı ";
endif;
}
function ekle ($baglanti){
$buton=@$_POST["buton"];
if($buton):
$ad= htmlspecialchars ($_POST["ad"]);
$soyad= htmlspecialchars ($_POST["soyad"]);
$yas= htmlspecialchars ($_POST["yas"]);
$aidat=htmlspecialchars($_POST["aidat"]);
if (empty ($ad) or empty ($soyad) or empty ($yas) or empty ($aidat) ):
echo"boş alan bırakma ";
else:
$ekleme=$baglanti->prepare("insert into uyeler (ad,soyad,yas,aidat) VALUES(?,?,?,?)");
$ekleme->bindParam(1,$ad,PDO::PARAM_STR);
$ekleme->bindParam(2,$soyad,PDO::PARAM_STR);
$ekleme->bindParam(3,$yas,PDO::PARAM_STR);
$ekleme->bindParam(4,$aidat,PDO::PARAM_INT);
$ekleme->execute();
echo "ekleme başarılı ";
endif;
endif;
echo '<table class="table table-border table-striped text-center bg-white">
<thead>
<tr>
<th colspan="6">Üye Ekleme</th>
</tr>
</thead>
<tbody>
<tr>
<td colspan="6">
<form action="index.php?hareket=ekle" method="post">;
<input type="text" name="ad" class="form-control mx-auto col-md-3 mt-2" placeholder="ad yaz" />
<input type="text" name="soyad" class="form-control mx-auto col-md-3 mt-2" placeholder="soyad yaz" />
<input type="text" name="yas" class="form-control mx-auto col-md-3 mt-2" placeholder="yas yaz" />
<input type="text" name="aidat" class="form-control mx-auto col-md-3 mt-2" placeholder="aidat yaz" />
<input type="submit" name="buton" class="btn btn-success" value="EKLE" />
</form>
</td>
<tr>
</tbody>
</table>';
}
function listele($baglanti){
$sorgu=$baglanti->prepare("select * from uyeler") ;
$sorgu->execute();
if($sorgu->rowCount()==0):
echo'<tr>
<td colspan="6"> Kayıtlı Üye Yok</td>
</tr>';
else:
while ($cikti=$sorgu->fetch(PDO::FETCH_ASSOC)):
echo ' <tr>
<td>'.$cikti["ad"].'</td>
<td>'.$cikti["soyad"].'</td>
<td>'.$cikti["yas"].'</td>
<td>'.$cikti["aidat"].'</td>
<td><a href="index.php?hareket=uyeguncelle&id='.$cikti["id"].'" class="btn btn-warning" >Güncelle </a> </td>
<td><a href="index.php?hareket=uyesil&id='.$cikti["id"].'" class="btn btn-danger" >Sil </a></td>
</tr>';
endwhile;
endif;
}
}
?>